Skip to content

Commit

Permalink
actually include docs...
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed May 17, 2024
1 parent 4ca2190 commit d8367ca
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/src/saving.md
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")
```
13 changes: 13 additions & 0 deletions docs/src/settings.md
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.
10 changes: 10 additions & 0 deletions docs/src/source.md
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.
```

0 comments on commit d8367ca

Please sign in to comment.