Hi,
I am stuck with an apparently simple problem. I am using PlotlyJS v0.18.8, Julia 1.8.1. I have some time series. If I plot each one separately, I have no problem: all layout attributes are fully displayed. For example, the following code will produce the plot below:
function gov()
trace10_1 = scatter(;x = Date.(period10_1), y = GDP_shares[213:302,4],
name = "G/GDP", line_color = "DarkRed", mode = "markers+lines",
marker_size = 6, marker_symbol = "circle", line_width = 0.3)
layout10_1 = Layout(;
shapes = shape10_1,
title_text = "Government as % GDP",
title_x = 0.5,
hovermode = "x",
yaxis_title = "% points",
#yaxis_range=[17.2, 21.5],
titlefont_size = 16)
fig10_1 = plot(trace10_1, layout10_1)
end
gov()
However, when I use the PlotlyJS syntax to produce subplots, some of the individual layout attributes passed to the plot will be lost. For example, it preserves the correct title
, but the hovermode="x"
and shapes
are gone. The following code, and its associated plot (below), show this problem very clearly:
fig10_5 = [gov() invest()]
If I try to force the inclusion of those two layout attributes by using the relayout!
functionality, I succeed with the hovermode="x"
, but fail concerning shapes
. I do not know why hovermode="x"
appears now in both subplots, while shapes
is only inserted in the first subplot. Code and plot below:
fig10_5 = [gov() invest()]
relayout!(fig10_5, Layout(hovermode="x", shapes = shape10_1))
fig10_5
The funny part is that I need those shapes on multiple subplots.
Any help will be very much appreciated. Thanks.