Skip to content Skip to sidebar Skip to footer

Inline Interactive Plots With Julia In Jupyter Notebook

when I use %matplotlib notebook import matplotlib.pyplot as plt I get interactive plots, i.e. I can also zoom into the figure. For julia this command does not seem to exist. Any

Solution 1:

You can get interactive plots by using Plotly, either directly with Plotly.jl or through its Plots backend.

Solution 2:

Today I am thinking about how to enlarge the plot window interactively without referring to python or plotly or something else in Jupiter notebook. And I find a good solution. It is to use the package Interact. A simple example is as follows. You can get an interactive plot in 3 lines.

  import Pkg; Pkg.add("Interact")
  using LinearAlgebra, Plots, Interact

  @manipulatefor n in10:100, w in200:1000, h in200:1000
    plot(randn(n),randn(n),seriestype=:scatter,label="n=$(n)",size = (w, h))
  end

The result looks like this enter image description here

Post a Comment for "Inline Interactive Plots With Julia In Jupyter Notebook"