I was trying to extend the following example to incude more subplots
I want to create subplots in which one subplot has a secondary y-axis.
Everything works fine in the 2 sub plot case.
my_plot = PlotlyJS.make_subplots(
rows=2, cols=1,
vertical_spacing=0.05, shared_xaxes=true,
specs=hcat([Spec(kind="xy", secondary_y = false),
Spec(kind="xy", secondary_y = true)]),
);
This works as expected, 3 y-axes are created (1 extra for the secondary y-axis)
julia> my_plot.plot.layout
layout with fields annotations, margin, template, xaxis, xaxis2, yaxis, yaxis2, and yaxis3
However when I create 3 subplots
my_plot_2 = PlotlyJS.make_subplots(
rows=3, cols=1,
vertical_spacing=0.05, shared_xaxes=true,
specs=hcat([Spec(kind="xy", secondary_y = false),
Spec(kind="xy", secondary_y = true),
Spec(kind="xy", secondary_y = false)]),
);
the fourth y-axis (i.e. the secondary y-axis of the 2nd subplot is not created)
julia> my_plot_2.plot.layout
layout with fields annotations, margin, template, xaxis, xaxis2, xaxis3, yaxis, yaxis2, and yaxis3
Is this a bug or have I am I missing something?
I have noticed if I make set up the subplots so the last subplot has a secondary y-axis then as expected 4 y axes are created.
my_plot_3 = PlotlyJS.make_subplots(
rows=3, cols=1,
vertical_spacing=0.05, shared_xaxes=true,
specs=hcat([Spec(kind="xy", secondary_y = false),
Spec(kind="xy", secondary_y = false),
Spec(kind="xy", secondary_y = true)]),
);
julia> my_plot_3.plot.layout
layout with fields annotations, margin, template, xaxis, xaxis2, xaxis3, yaxis, yaxis2, yaxis3, and yaxis4
Any other variation doesn’t create the extra y-axes and any subsequent plotting is impacted.