python - 从命令行在 julia 中打印绘图

标签 python matplotlib plot julia

我想使用 Julia 语言在屏幕上打印一个图。我已经添加了 Pkg.add("PyPlot") 并且 Julia 说它已经安装了。所以这里有我要执行的代码:

using PyPlot
x = linspace(0, 10, 200)
y = sin.(x)
plot(x, y, "b-", linewidth=2)

但是一旦我尝试像这样从命令行运行它:

julia example.jl

这需要一段时间,然后什么也没有发生。任何帮助将不胜感激。

最佳答案

你只需要将你的情节保存在某个地方:

using PyPlot
x = linspace(0, 10, 200)
y = sin.(x)
plot(x, y, "b-", linewidth=2)
savefig("my_plot.pdf")

关于python - 从命令行在 julia 中打印绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47377003/

相关文章:

python - 如何使用 twinx 并仍然获得方形图

当时间转换为 timedelta64 时,Python matplotlib.pyplot 正在绘制不同的图形

python - Matplotlib:将plot_surface中的cmap设置为x轴和y轴

python - Scipy:在循环中逐个事件地填充从数据库读取的直方图

java - 为什么 java 也是系统/操作系统名称(python 中的帮助文档)?

python - np.where() 内部存在 & 的问题

Matplotlib 和时间戳造成麻烦

python - 在 Windows 上使用 Python 3.4 64 位构建 VRPN 服务器

python - 如何使用 plt.gca() 从 matplotlib 散点图中获取 x 和 y 坐标?

python - 如何使 matplotlibs nbagg 后端生成 SVG?