gpt4 book ai didi

matplotlib - julia notebook 交互窗口 pyplot

转载 作者:行者123 更新时间:2023-12-04 12:46:16 26 4
gpt4 key购买 nike

如何使用 Jupyter notebook 中的交互式 PyPlot 制作我的 3d 绘图?

我有一个曲面图:

using PyPlot
x=1:0.1:10
y=x'
z=x.^2 + y.^2
surf(x,y,z)

但它在我笔记本的固定窗口中。

最佳答案

使用:PyPlot; pygui(true) 打开一个独立的 GUI 窗口。

尝试运行 %matplotlib notebook 并查看输出:

The analogue of IPython's %matplotlib in Julia is to use the PyPlot package, which gives a Julia interface to Matplotlib including inline plots in IJulia notebooks. (The equivalent of numpy is already loaded by default in Julia.)

Given PyPlot, the analogue of %matplotlib inline is using PyPlot, since PyPlot defaults to inline plots in IJulia.

To enable separate GUI windows in PyPlot, analogous to %matplotlib, do using PyPlot; pygui(true). To specify a particular gui backend, analogous to %matplotlib gui, you can either do using PyPlot; pygui(:gui); using PyPlot; pygui(true) (where gui is wx, qt, tk, or gtk), or you can do ENV["MPLBACKEND"]=backend; using PyPlot; pygui(true) (where backend is the name of a Matplotlib backend, like tkagg).

For more options, see the PyPlot documentation.

关于matplotlib - julia notebook 交互窗口 pyplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46994840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com