Skip to content

Commit

Permalink
README: recommend plot instead of PlutoPlot(Plot(...))
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Feb 21, 2024
1 parent df3b328 commit c5eb1a8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5eb1a8

Please sign in to comment.