2D contour from .csv

OK. What you are describing is not actually contours but rather the coloring of a flat surface. So the first think you need to do is change how you are using Table To Points to generate a flat surface rather than the raised surface. (You are actually making a 3D surface plot, which is useful in its own right, but not what you are asking for.) To do this, turn on the 2D Points option on the Table To Points filter. The Z Column options will then be ignored and all the points will be placed in the x-y plane, which is once you want.

Then when you run Delaunay 2D filter, you will get a flat surface. In the second toolbar you can then select your 3rd column of data for the coloring. From your spreadsheet screenshot, it looks like you have no headers, so I assume that the name of the data will be Field 2.

(Incidentally, I used the data from this csv file, which I generated, for this image: data-to-contour.csv. Generally, it would have been better for you to post your csv file rather than a screenshot of some of the data. I would have created these examples with your data if you had done so.)

Getting back to actual contours, if you see contour lines in the video screenshot you posted, then they are caused by lines created by your visual system due to the uneven colors being chosen. I’m not a fan of those colors being used because of these weird effects that can happen in your visual system. Contours that you see could be argued as a happy accident, but if you really want to establish contours, it makes more sense to do so using more precise methods than visual artifacts from poorly chosen colors.

If you want to create contours using jumps in colors (which is a fine way to create a contour on a surface), then it can be done by creating a jump in the colors used in the color map. The easiest way to to create these jumps is to go to the color map editor pqEditColor24 and use the Descretize option. This option is actually on by default but uses too many colors to differentiate (for technical reasons). Simply lower the Number Of Table Values to a smaller number (such as 10) so that you can see the transitions clearly. The screenshot below shows this. I also changed the colors used. The default colors are fine, but because you have a flat surface you don’t have to worry about shading and other maps give you more differences in colors. I’ve used the Viridis color map here, which is pretty popular. You can get to this and more by going to the color favorites pqFavorites16 in the color map editor.

If you really want contours, as in extracting the curves in the surface representing specific values, you can do that too with the Contour filter as you were trying to earlier. The Contour filter should now be available as you now have a field on your data from which it can grab contours. In the screenshot below, I have done just that. I also changed the colors in the color map editor to Interpret Values As Categories so that you have a specific color for each contour.

1 Like