Rectangle using pyplot vs. gr?

Using pyplot as backend, the following draws a rectangle:

pyplot()
plot([(1,1),(5,1),(5,3),(1,3),(1,1)])

while if I change pyplot() to gr(), a partial rectangle is drawn, and then an error message is generated: GKS: Rectangle definition is invalid in routine SET_VIEWPORT

Question: Why?

I do not get any error using gr() with that. But just to add, if you want to control the fill of the rectangle, etc, you can use:

julia> using Plots
julia> plot([(1,1),(5,1),(5,3),(1,3),(1,1)],
            seriestype=:shape,fillcolor=:green,linecolor=:blue,linewidth=3)

square

1 Like