我正在制作一个streamlit应用程序,但是我的图表的左侧和右侧有大量的空白区域。我想删除边距并水平放置一些图表。如何删除应用程序左侧和右侧的边距?我从我一直关注的教程中获得了此代码。
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import plotly_express as px
def stats(dataframe):
st.header('Data Statistics')
st.write(dataframe.describe())
def data_header(dataframe):
st.header('Data Header')
st.write(dataframe.head())
def plot(dataframe):
fig, ax = plt.subplots(1,1)
ax.scatter(x = dataframe['Depth'], y = dataframe['Magnitude'])
ax.set_xlabel('Depth')
ax.set_ylabel('Magnitude')
st.pyplot(fig)
def interactive_plot(dataframe):
x_axis_val = st.selectbox('Select x-axis attribute', options = df.columns)
y_axis_val = st.selectbox('Select y-axis attribute', options = df.columns)
col = st.color_picker('Select a plot color')
plot = px.scatter(dataframe, x = x_axis_val, y = y_axis_val)
plot.update_traces(marker = dict(color = col))
st.plotly_chart(plot)
st.title('Earthquake Data Explorer')
st.text('This is a web app to explore earthquake data.')
# st.markdown('## This is **markdown**.')
st.sidebar.title('Navigation')
uploaded_file = st.sidebar.file_uploader('Upload your file here.')
options = st.sidebar.radio('Pages', options = ['Home', 'Data Statistics', 'Data Header', 'Plot', 'Interactive Plot'])
df = pd.read_csv('/Users/deisert/Documents/FAA-Sabin/Dashboard/kaggle_significant_earthquakes_database.csv')
if options == 'Data Statistics':
stats(df)
elif options == 'Data Header':
data_header(df)
elif options == 'Plot':
plot(df)
elif options == 'Interactive Plot':
interactive_plot(df)