How do you set the box width in a plotly box in python? -
How do you set the box width in a plotly box in python? -
i have following;
y = time_h time_box = box( y=y, name='time (hours)', boxmean=true, marker=marker(color='green'), boxpoints='all', jitter=0.5, pointpos=-2.0 ) layout = layout( title='time box', ) fig = figure(data=data([time_box]), layout=layout) plotly.image.save_as(fig, os.path.join(output_images, 'time_box.png'))
this renders next graph:
the box wide , haven't been able find in docs.
you can mess around boxgap
(and boxgroupgap
when there multiple boxes @ different x locations, here: https://plot.ly/python/box-plots/#grouped-box-plot) property within layout
. more details here: plotly python reference - box gap
make sure have version 1.3.1 or higher. $ pip install plotly --upgrade
import plotly.plotly py plotly.graph_objs import * info = data([ box( y=[0, 1, 1, 2, 3, 5, 8, 13, 21], boxpoints='all', jitter=0.3, pointpos=-1.8 ) ]) layout = layout( boxgap=0.5 ) fig = figure(data=data, layout=layout) plot_url = py.plot(fig, filename='box-plot-with-gap')
https://plot.ly/~chris/3048
some more examples:
boxgap=0
, boxgroupgap=0
:
boxgap=0.25
, boxgroupgap=0
:
boxgap=0
, boxgroupgap=0.25
:
boxgap=0.25
, boxgroupgap=0.25
:
it's helpful play around these parameters in workspace, can modify every parameter of graphs:
python plotly
Comments
Post a Comment