Today I wanted to figure out, how to modify the axis type of one specific subplot.
My question is, how do I figure out stuff like this, if I am not successful to find anything by internet search?
What is the best approach? Trial and error? Or reading the Julia source code of the package PlotlyJS? Or is there some documentation of which I am not aware of?
In the end I figured out how to acchieve this task, here some code that might help other to understand better, how to analyse the structure of the plot object:
using PlotlyJS
hdl_trace1 = scatter(x=[1, 2], y=[1, 2], name="(tr1)")
hdl_trace2 = scatter(x=[1, 2], y=[2, 3], name="(tr2)")
hdl_trace3 = scatter(x=[1, 2], y=[3, 4], name="(tr3)")
# --- plot with three subplots in one column:
hdl_plt = make_subplots(rows=3, cols=1, specs = [ Spec(kind="xy") missing; Spec(kind="xy") missing; Spec(kind="xy") missing])
add_trace!(hdl_plt, hdl_trace1, row=1, col=1)
add_trace!(hdl_plt, hdl_trace2, row=2, col=1)
add_trace!(hdl_plt, hdl_trace3, row=2, col=1)
# --- modify title:
relayout!(hdl_plt, title_text="Example subplots: two row by one colum plot")
# --- modyfy xaxis_type of 2nd subplot:
relayout!(hdl_plt, xaxis2_type="log")
# --- investigate plot handle / plot object:
for (a,b) in hdl_trace2
println(a)
end
hdl_trace2["y"]
hdl_trace2["type"]
hdl_trace2["name"]
hdl_trace2["x"]
for (a,b) in hdl_plt.plot.layout
println(a)
end
for (a,b) in hdl_plt.plot.layout.xaxis2
println(a)
end
hdl_plt.plot.layout.xaxis2
hdl_plt.plot.layout.template.layout.xaxis
