wizualizacja_projekt_3/utils/graphs.py

46 lines
1004 B
Python
Raw Normal View History

2022-06-18 14:42:39 +02:00
import plotly.express as px
def create_engine_vol_histogram(df):
fig = px.histogram(df, x="vol_engine", nbins=40)
fig.update_layout(
xaxis = {
'title': 'Engine volume',
'visible': True,
'showticklabels': True
},
yaxis = {
'title': '',
'visible': True,
'showticklabels': True
},
margin = {
'l': 0, # left
'r': 10, # right
't': 50, # top
'b': 10, # bottom
}
)
return fig
def create_price_boxplot(df):
fig = px.box(df, x='year', y='price')
fig.update_layout(
xaxis = {
'title': 'Year'
},
yaxis = {
'title': 'Price'
},
margin = {
'l': 0,
'r': 0,
't': 50,
'b': 10
}
)
return fig