Hi!
I’m new to Julia. I’m trying to do simple contour plot using Cairomakie.
I’m not able to change the linestyle of the plot, i.e., “positive” value is for solid line and “negative” value is dotted line (it’s default in python matplotlib).
Is there a way to do it in Cairomakie?
One contour call is currently drawn with a single lines invocation to be more performant, but lines does not allow for multiple linestyles to be passed (which sort of makes sense because you cannot interpolate between two different linestyles between two adjacent points).
So the workaround is to call contour multiple times, either once per level, or just once per linestyle. You can pass the desired levels manually:
xs = LinRange(0, 10, 100)
ys = LinRange(0, 15, 100)
zs = [cos(x) * sin(y) for x in xs, y in ys]
f, ax, c = contour(xs, ys, zs, levels = [-0.2, -0.4, -0.6, -0.8], linestyle=:dashdot, colormap = :Blues)
contour!(ax, xs, ys, zs, levels = [0, 0.2, 0.4, 0.6, 0.8], colormap = :Reds)
f