I can’t get GR to draw contour_labels
when axes are log-scaled:
using Plots
using FileIO
x = 1:0.5:20
y = 1:0.5:10
f(x, y) = (3x + y ^ 2) * abs(sin(x) + cos(y))
pyplot()
p1 = contour(x, y, f,
fill=false,
scale=:identity,
contour_labels=true,
foreground_color=:blue,
)
p2 = contour(x, y, f,
fill=false,
scale=:log10,
contour_labels=true,
foreground_color=:blue,
)
p = plot(p1, p2, size=(1200,500), dpi=300,)
savefig(p, "/tmp/contour_pyplot.png")
gr()
p1 = contour(x, y, f,
fill=false,
scale=:identity,
contour_labels=true,
foreground_color=:blue,
)
p2 = contour(x, y, f,
fill=false,
scale=:log10,
contour_labels=true,
foreground_color=:blue,
)
p = plot(p1, p2, size=(1200,500), dpi=300,)
savefig(p, "/tmp/contour_gr.png")
p1 = plot(load("/tmp/contour_pyplot.png"), title="pyplot")
p2 = plot(load("/tmp/contour_gr.png"), title="gr")
p = plot(p1,p2, layout=(2,1), size=(1200,1200), dpi=300,)
savefig(p, "/tmp/comparison.png")
return p
This is under Julia 1.7, Plots v1.28.0, PyPlot v2.10.0, GR v0.64.2.
Possibly related to #2430.
contour_labels
and scale
are individually supported.
It’s possible they are being drawn off-camera, at some non-scaled location; can anyone show me how to inspect the figure properties like you can in Matlab? Any other suggestions or should I file a bug in Plots?
Thanks, Ben