Open Rehana02 opened 1 month ago
Don't set end
within histogram definition, but later, after the plot definition (go.Figure
in plotly.py):
using PlotlyJS
x = randn(1000)
pl = Plot(histogram(x=x, histnorm="probability density", start=-3, size=0.1),
Layout(width=500, height=350, bargap=0.01))
pl.data[1].end = 3
display(pl)
If pl
is defined as PlotlyJS.SyncPlot
, i.e. pl=plot(histogram(...))
, not Plot
as above,
then end
is set like here:
pl.plot.data[1].end=3
I am using PlotlyJS to plot a histogram. To make the bins centered around x axis tick values, I am using the following script:
m1 is the parameter along the x_axis
bin_start = minimum(m1) + 0.25 # Starting value of bins bin_end = maximum(m1) - 0.25 # Ending value of bins bin_size = 0.5 # Size of each bin
histogram( x = m1, yaxis = "y2", xbins = attr( start = bin_start, end = bin_end, size = bin_size ), marker = attr( color = "rgba(0,0,0,1)" ) )
However, I get a ParseError saying " start = bin_start, end = bin_end,
└ ── Expected
)
"This is probably because of the "end" keyword which is a reserved keyword in Julia ("end" keyword is highlighted as well in my script). What can I do so that Julia does not recognize it as a reserved keyword? Or is there any other way to set the bin end?