From d8367ca36f58d172172b3b96a7b7841dcfbd928e Mon Sep 17 00:00:00 2001 From: Josh Day Date: Fri, 17 May 2024 15:59:11 -0400 Subject: [PATCH] actually include docs... --- docs/src/saving.md | 24 ++++++++++++++++++++++++ docs/src/settings.md | 13 +++++++++++++ docs/src/source.md | 10 ++++++++++ 3 files changed, 47 insertions(+) create mode 100644 docs/src/saving.md create mode 100644 docs/src/settings.md create mode 100644 docs/src/source.md diff --git a/docs/src/saving.md b/docs/src/saving.md new file mode 100644 index 0000000..4f5fb60 --- /dev/null +++ b/docs/src/saving.md @@ -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") +``` diff --git a/docs/src/settings.md b/docs/src/settings.md new file mode 100644 index 0000000..035d176 --- /dev/null +++ b/docs/src/settings.md @@ -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. diff --git a/docs/src/source.md b/docs/src/source.md new file mode 100644 index 0000000..2721593 --- /dev/null +++ b/docs/src/source.md @@ -0,0 +1,10 @@ +# Plotly.js Source Presets + +Change how the plotly.js script gets loaded in the produced html via `preset.source.