JuliaPlots / JuliaPlots/PlotlyJS.jl

Options provided to plot(..., options=Dict) arent recognized when calling savefig

Open
#366 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Hi! The options specified in `P = plot(rand(10, 4), options=Dict(:staticPlot => true))` aren't recognized when I call `savefig(P, "out.html")` and view the resulting HTML file in my browser, as the plot isn't static. (This is the minimal example given in `PlotlyJS.jl/docs/src/syncplots.md`.)

Here's a more full example taken from #326:

```
using PlotlyJS

trace1 = scatter(
x=[0, 1, 2, 3, 4, 5, 6],
y= [1, 9, 4, 7, 5, 2, 4],
mode= "markers",
marker_size = [20, 40, 25, 10, 60, 90, 30]
)

layout = Layout(;
title= "Download Chart as SVG instead of PNG",
showlegend= false
);

config = Dict(
:toImageButtonOptions => Dict(
:format => "svg",
:filename => "custom_image",
:height => 500,
:width => 700,
:scale => 1 # Multiply title/legend/axis/canvas sizes by this factor
)
);
P = plot(trace1,layout;options=config)
savefig(P, "out.html")
```

When I view `out.html` in my browser, the "download image" button still gives a PNG with the default dimensions, not an SVG. The options I specified are not present in the `out.html` source. The problem occurs for me on Julia 1.5.3 with PlotlyJS.jl v0.14.0 or the master HEAD.

Thanks for any help you can provide!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.