Exploiting the interactivity of Plots backends
In the previous section, we have seen that multiple Plots
backends offer interactivity out of the box—in particular, Gaston
, InspectDR
, PyPlot
, Plotly
, and PlotlyJS
. Among those, Plotly
and PlotlyJS
provide the largest number of available interactive actions. So, let’s try the interactive capabilities of Plots
utilizing the Plotly
backend, as follows:
- Open the Julia REPL and execute
using Plots
to load thePlots
package. - Execute
plotly()
on the Julia REPL to use thePlotly
backend that comes withPlots
. - Run the following code to generate example data:
x = 0:0.1:2pi y_sin = sin.(x) y_cos = cos.(x)
- Execute
plot(x, [y_sin y_cos], labels=["sin" "cos"])
to create a plot that would be rendered withPlotly
. Let’s interact with it. - Move the mouse over the plot; you will see that a toolbox appears on the top right. The options on the toolbox depend on the plot type, and they can also...