Extracting vector of contour lines from Makie.contour?

Hi,
I’d like to extract contour lines from a Makie contour plot as a vector, like the black lines in the plot here.

Is there any way to do that?

I’ve not been able to find this in the Makie documentation, so I’m not sure if this is considered Makie internals, but you can get contour lines by calling

cs = Makie.Contours.contours( x , y , Z , levels )

You then access the vertices (x-y pairs) for each contour line as

cs.contours[level_idx].lines[line_idx].vertices

This may not exactly solve your problem though, as it does not retrieve already plotted lines.

1 Like

Thanks, that’s exactly what I need. Just needed the contour lines, not necessarily the plot.