julia - 如何使用 Plots.jl 在图像上绘图?

标签 julia plots.jl

我想使用 Plots.jl 在图像上绘图,例如简单的正弦曲线。这是我的代码:

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")

但是我得到了错误的结果。如何正确执行此操作?

最佳答案

这里有一个简单的例子,希望能给你一些线索:

julia> plot(img)

julia> plot!(x->200sin(.05x)+300, 0, 700, w=5)

您可能只想确保绘制到与图像匹配的正确坐标。

关于julia - 如何使用 Plots.jl 在图像上绘图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41704558/

相关文章:

julia - 带有 plots.jl 的误差条的颜色

julia - 从包含数据类型 UInt8 的数组中绘制图像

julia - Julia 中的 UndefVarError

python - 在线程上从 Python 调用 Julia

plot - 如何使用 Plots.jl 缩放字体大小

julia - 如何只为一个轴而不是两个轴设置小刻度线的数量?

julia - 增加 Plots.jl 中子图之间的空间

function - 在julia 1.0中,什么新语法?错误: { } vector syntax is discontinued

julia - 替换 Julia 中的缺失值

julia - 类似 Matlab 的 Julia 调试工具