在朱莉娅中保存情节图
我是朱莉娅(Julia)的新手,正在使用图。jl[gr]库来创建图。我试图将我的情节保存为PNG,以显示在我的GTK GUI上。我可以使用savefig函数(
的: https://stackoverflow.com/a/62981826/13306172
遵循这篇文章是
ERROR: MethodError: no method matching savefig(::Plots.Plot{Plots.GRBackend}, ::String)
x = 1:10; y = rand(10, 4)
import GR
using Plots
using PlotlyBase
using PlotlySave
gr()
import PlotlySave.savefig
function return_image_plot()
x = 1:10; y = rand(10, 4)
x1 = 1:10; y1 = rand(10, 1)
plot1 = Plots.plot(x, y)
plot2 = Plots.plot(x1, y1)
plotty = Plots.plot(plot1, plot2, layout = (2, 1))
Plots.savefig(plotty, "ploty2.png")
end
不成功 我还尝试使用我还尝试使用PlotySave Julia库 https://github.com/github.com/hhaensel/plotlysave。 jl 但没有成功,还收到了我遵循/复制多个SOF帖子的“无匹配方法”错误
,但仍未成功。任何帮助都将受到赞赏。
I am new to Julia and am using the Plots.jl [GR] library to create plots. I am trying to save my plot as a PNG to display on my GTK GUI. I am able to save the plot as an html file and text file but not .png using the savefig function (https://docs.juliaplots.org/latest/api/#Plots.savefig-Tuple{Plots.Plot,%20AbstractString})
I have been unsuccessful following this post: https://stackoverflow.com/a/62981826/13306172
The error i receive is:
ERROR: MethodError: no method matching savefig(::Plots.Plot{Plots.GRBackend}, ::String)
x = 1:10; y = rand(10, 4)
import GR
using Plots
using PlotlyBase
using PlotlySave
gr()
import PlotlySave.savefig
function return_image_plot()
x = 1:10; y = rand(10, 4)
x1 = 1:10; y1 = rand(10, 1)
plot1 = Plots.plot(x, y)
plot2 = Plots.plot(x1, y1)
plotty = Plots.plot(plot1, plot2, layout = (2, 1))
Plots.savefig(plotty, "ploty2.png")
end
I also attempted to use I also attempted to use PlotySave Julia library https://github.com/hhaensel/PlotlySave.jl but was unsuccessful and also received a 'no matching method' error
I have followed/copied multiple SoF posts but have continued to be unsuccessful. Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下操作:
Try this: