3

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 Answers1

6

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.

Tom Breloff
  • 1,782
  • 9
  • 15
  • Thanks for the answer, with your code got error: `ERROR: LoadError: UndefVarError: adapted_grid not defined in macro expansion at E:\Julia\JPackages\v0.5\Plots\src\series.jl:440 [inlined]` –  Jan 17 '17 at 20:01
  • But yes, you're right, I not at once understand correctly principle the placement of coordinate. –  Jan 17 '17 at 22:20