Today it gave me a bit of a headache to figure out how to use the function hline()
inside a PlotlyJS
-figure.
By text string search inside the PlotlyJS
-package I was able to put a minimal example together, I hope it helps others to get started.
Maybe someone knows a good tutorial for PlotlyJS
that describe such things as xref="paper"
in combination with shapes
?
Here my example:
function myplot()
trace_ = scatter(;x = [1,2,3,4,5], y = [-2,-1,0,1,2])
plt_layout = PlotlyJS.Layout(;
shapes = PlotlyJS.hline([0], 0, [0.0, 1.0]; xref="paper", line_color="green", line_dash="dash", ),
)
return PlotlyJS.Plot(trace_, plt_layout)
end
hdl_ = myplot()