From c5eb1a88bf532b7738793f8bae293922963d10e4 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Wed, 21 Feb 2024 10:12:53 +0100 Subject: [PATCH] README: recommend `plot` instead of `PlutoPlot(Plot(...))` --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9c43e6e..3ef4d95 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,24 @@ This package provides a wrapper type `PlutoPlot` around the `Plot` type from [Pl The wrapper mostly defines a custom `show` method specifically optimized for displaying inside of [Pluto.jl](https://github.com/fonsp/Pluto.jl/) and adds the options of providing custom javascript functions to attach to the [plolty JS events](https://plotly.com/javascript/plotlyjs-events/) -Basic use of this package is to load this inside Pluto instead of PlotlyBase or PlotlyJS, and then simply wrap the intended `Plot` objects from PlotlyBase inside a PlutoPlot as +You can load the PlutoPlotly package *instead of* PlotlyBase or PlotlyJS, and replace `Plot` with `plot` from PlutoPlotly. For example: + ```julia -p = Plot(args...) -PlutoPlot(p) +plot([5,6,7,2]; line_color="red") ``` -One could also used the convenience exported function `plot`: -```julia -function plot(args...;kwargs...) - @nospecialize - PlutoPlot(Plot(args...;kwargs...)) +You can also create a PlotlyBase `Plot`, and then wrap it inside a `PlutoPlot` object: +```julia +let + # create a PlotlyBase function + p = Plot(args...) + # wrap it + PlutoPlot(p) end ``` +(The function `plot(args...)` from PlutoPlotly is the same as `PlutoPlot(Plot(args...))`.) + # Features ## Persistent Layout