0

I am trying to plot a bar chart using python and plotly, but the size of the bar is high. I want to reduce the size of the bar. Can anyone help me? image of baar plotand I am sharing my code.

data_plots = go.Bar(x=df1['MeterReading_DateTime'], y= df1['ACT_IMP_TOT'],marker = {'color' : '#060805'},width = 1)
layout = {'title': '','xaxis': {'title': 'Date and time'},'yaxis': {'title': 'Total Import(KWH)'},'plot_bgcolor':'#8099b3' }
fig = {'data': data_plots, 'layout': layout}
plot_div = offline.plot(fig, output_type='div')
return plot_div
petezurich
  • 9,280
  • 9
  • 43
  • 57
code
  • 27
  • 4
  • The size of the bar depends on your input data. What does it meant "is high"? Is it different from what you expect given the data? Please include a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and include the dataframe https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples – alec_djinn Sep 09 '22 at 04:52
  • They give recommendations to change the height using styles or the layout property of the figure. https://community.plotly.com/t/cant-seem-to-change-default-height-on-graph/6742#:~:text=Nov%20%2717-,That%20height,-is%20set%20automatically – Сергей Кох Sep 09 '22 at 08:25
  • 1
    The maximum width specified for a bar graph is 1. I believe it is automatically calculated by the number of elements on the x-axis for the default graph size. So you can adjust the width to be narrower than 0.5 or 1 or less. – r-beginners Sep 09 '22 at 09:19

0 Answers0