varantir
varantir

Reputation: 6854

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 ideas?

Upvotes: 4

Views: 3717

Answers (2)

Yong Yang
Yong Yang

Reputation: 1322

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

  @manipulate for n in 10:100, w in 200:1000, h in 200:1000
    plot(randn(n),randn(n),seriestype=:scatter,label="n=$(n)",size = (w, h))
  end

The result looks like this enter image description here

Upvotes: 2

tlqmj
tlqmj

Reputation: 53

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

Upvotes: 5

Related Questions