How plot on Images with Plots.jl?

天大地大妈咪最大 提交于 2019-12-10 11:06:49

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41704558/how-plot-on-images-with-plots-jl

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