如何使用 Plots.jl 绘制图像? [英] How plot on Images with Plots.jl?
本文介绍了如何使用 Plots.jl 绘制图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 Plots.jl 绘制图像,例如简单的正弦曲线.这是我的代码:
I want using Plots.jl for plot on Images, for example simple sinusoid. Here my code:
using Plots
using Images
gr()
h = 400
w = 600
a = Array(RGB{FixedPointNumbers.UFixed{UInt8,8}}, h, w)
img = Image(a)
p=plot(img)
x = collect(0:0.1:2π)
plot!(x,sin(x))
png("Test")
但是我得到了错误的结果.如何正确执行?
But I get wrong result. How do this correctly?
推荐答案
这是一个简单的例子,希望能给你一些线索:
Here's a quick example that I hope gives you some clues:
julia> plot(img)
julia> plot!(x->200sin(.05x)+300, 0, 700, w=5)
您可能只想确保绘制到与图像匹配的正确坐标.
You probably just want to ensure that you're plotting to the right coordinates that match the image.
这篇关于如何使用 Plots.jl 绘制图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文