Inline Interactive Plots with Julia in jupyter notebook

。_饼干妹妹 提交于 2020-12-11 23:56:54

问题


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?


回答1:


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




回答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

  @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



来源:https://stackoverflow.com/questions/58014289/inline-interactive-plots-with-julia-in-jupyter-notebook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!