Hi. I am using PlotlyJS v0.14.1, PlotlyBase v0.4.3, WebIO v0.8.15, and Julia v 1.6.1. Moreover, I am on a Windows 10 machine.
I have encountered a problem when I save a particular figure in pdf or html formats. Not always, but in some cases, what we see when the figure is displayed on the Electron window is quite different from what we get if we save the figure in any of those two formats (at least the piece of code is exactly the same, apart from the savefig()
).
As an MWE, I will use a fine piece of code I found in the Julia discourse exchanges (I run this in VSCode)
using PlotlyJS, Dates
dates = [Date(2021, 05, 08), Date(2021, 05, 09), Date(2021, 05, 10)]
trace1 = bar(; x = dates, y = [15, 1, 6], name = "Buy - euro", barmode="stack", legendgroup = "euro", marker_color = "Orange")
trace2 = bar(; x = dates, y = [2, 5, 4], name = "Buy - usd", barmode="stack", legendgroup = "usd", marker_color = "Green")
tracesBuy = [trace1, trace2]
p1 = plot(tracesBuy, Layout(;barmode="stack", title="Buy"))
trace3 = bar(; x = dates, y = [-10, -5, -8], name = "Sell - euro", barmode="stack", legendgroup = "euro", showlegend = false, marker_color = "Orange")
trace4 = bar(; x = dates, y = [-15, -6, -3], name = "Sell - usd", barmode="stack", legendgroup = "usd", showlegend = false, marker_color = "Green")
tracesSell = [trace3, trace4]
p2 = plot(tracesSell, Layout(;barmode="stack", title="Sell"))
p = [p1 p2]
p.plot.layout["barmode"] = "stack"
p
#savefig(p, "C:/Users/Utilizador/Desktop/aaaFig1_PlotlyJS.html")
If I run the code without saving anything, this is the output I get:
If instead, I save the figure as a pdf or an html file, these are the outputs (the html remains interactive what is nice):
The html output:
and the pdf output:
Is there anything I should do to avoid this distortion of the original figure? @sglyon Thanks, and congrats on the wonderful package you have developed.