-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Saving Plots | ||
|
||
### Saving Plots As HTML | ||
|
||
```julia | ||
p = plot(y=rand(10)) | ||
|
||
PlotlyLight.save(p, "myplot.html") | ||
``` | ||
|
||
- Note: call `PlotlyLight.preset.source.standalone!()` first if you want the html file to contain the entire plotly.js script. This enables you to view the plot even without internet access. | ||
|
||
|
||
### Save Plots as Image via [PlotlyKaleido.jl](https://github.com/JuliaPlots/PlotlyKaleido.jl) | ||
|
||
```julia | ||
using PlotlyKaleido | ||
|
||
PlotlyKaleido.start() | ||
|
||
(;data, layout, config) = p | ||
|
||
PlotlyKaleido.savefig((; data, layout, config), "myplot.png") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Settings | ||
|
||
Occasionally the `PlotlyLight.preset`s aren't enough. Low level user-configurable settings are available in `PlotlyLight.settings`: | ||
|
||
```julia | ||
PlotlyLight.settings.src::Cobweb.Node # plotly.js script loader | ||
PlotlyLight.settings.div::Cobweb.Node # The plot-div | ||
PlotlyLight.settings.layout::EasyConfig.Config # default `layout` for all plots | ||
PlotlyLight.settings.config::EasyConfig.Config # default `config` for all plots | ||
PlotlyLight.settings.reuse_preview::Bool # In the REPL, open plots in same page (true, the default) or different pages. | ||
``` | ||
|
||
Check out e.g. `PlotlyLight.Settings().src` to examine default values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Plotly.js Source Presets | ||
|
||
Change how the plotly.js script gets loaded in the produced html via `preset.source.<option>!()`. | ||
|
||
```julia | ||
preset.source.none!() # Don't include the script. | ||
preset.source.cdn!() # Use the official plotly.js CDN. | ||
preset.source.local!() # Use a local version of the plotly.js script. | ||
preset.source.standalone!() # Copy-paste the plotly.js script into the html output. | ||
``` |