Large data set 2-Dcontour plot

I am in a position where I have all 3 x,y,z data points but my data set is very large (700,000 to > 1 million rows). I have only even been able to successfully generate the plot by having all x,y,z in a single 3-column wave and directly typing the command:

AppendXYZContour 'data_set'

and this takes between 6-9 HOURS to load the plot...Additionally, it takes another 6-9 hours to fill the color...all for 1 plot. 

So, I really would like to know if there is a faster way to do this with these large data sets, or if I am maybe misusing the Contour plot commands...but every other preset contour options would just give me errors or produce an incorrect plot by trying to calculate for one of the x,y,z columns.

Note: I have used Gizmo for generating the 3D version of my plot as well and it takes closer to 30 seconds to load, but I would really like to simply make the 2D contour directly for better quality results rather than just trying to manipulate the viewpoint of the Gizmo plot.

Thanks

Welcome to the forum. Can you tell us a bit more about your data? What is the purpose of the contour plot? I assume the x and y values are not equidistant. But in any case, it might be best to convert the XYZ values to a matrix (2D image) first and then work from there. This should vastly increase performance if you also can give up a bit of fidelity for display purposes. See here:

https://www.wavemetrics.com/forum/general/making-2d-wave-xyz-waves

Sure thing, I am making a contour plot to represent DRT (distribution of relaxation times) data from impedance data obtained of battery cycling. So I am essentially plotting log of relation time (tau) on x, test time duration on y, and measured resistance on the z axis, all of which I have the x,y,z data for already.

I believe what you are suggesting by converting them to a Matrix is what I am successfully able to do when I can plot the 2D image using that command AppendXYZContour. But my issue is the length of time this takes. Which, yes given the large number of rows I am not expecting it to plot in half a second, but even 30 minutes or an hour is better than 16 hours total plot and color fill time...

No, what I suggest is that you first transform your data before plotting it. With the command you use, Igor has to figure out where each point goes in 2D space on the fly, which surely takes forever. I believe first creating a 2D map and then plotting it should be orders of magnitude faster. You could also opt to reduce fidelity to increase the speed of the plotting part even more. Just try it out.

Maybe I am missing something as I am not sure what you mean by transform them? The XYZ data is already in a matrix.

Maybe we are talking past each other, but as I understand you you simply have your 3 individual rows of x, y, and z values sticked together into a triple column 'matrix'. Igor still has to go through each of these to figure out where they should go in your contour plot. If you instead recast the points into into a 'map' then this can be plotted in no time. Have you looked at the link? Maybe you could also share some small example of your data to demonstrate / test things.

Hello murphsam,

First note that drawing anything with unordered scatter XYZ data is time consuming because the underlying algorithm usually involves a Delaunay triangulation which is processed in time O(N^2).  Depending on the exact task at hand, you may want to reconsider using contours or image interpolation (both require triangulation).  Here are a few options to consider:

1. You could use ImageFromXYZ.  I am not sure about the performance here but the algorithm is O(N) not O(N^2).

2.  If you have a sufficient density of data, plot it as a simple 2D scatter with color as f(z).

3.  You can perform some pre-sorting to reduce the total points.  Look at the JointHistogram operation for that.

HTH,

A.G.

In reply to by Igor

Igor wrote:

Hello murphsam,

First note that drawing anything with unordered scatter XYZ data is time consuming because the underlying algorithm usually involves a Delaunay triangulation which is processed in time O(N^2).  Depending on the exact task at hand, you may want to reconsider using contours or image interpolation (both require triangulation).  Here are a few options to consider:

1. You could use ImageFromXYZ.  I am not sure about the performance here but the algorithm is O(N) not O(N^2).

2.  If you have a sufficient density of data, plot it as a simple 2D scatter with color as f(z).

3.  You can perform some pre-sorting to reduce the total points.  Look at the JointHistogram operation for that.

HTH,

A.G.

 

This worked great, I did not know you could do it this way! Thank you so much! Just saved me 100s of hours over the next 3 years!

The only issue I am now running into is much simpler, and that is why the image autoselects the top axis for x, and that the left y-axis goes from top to bottom rather than bottom to top. But, when I generate 3D plot from surface it flips it to the correct orientation?

Images are by default displayed starting from the top left corner, since this is how most images are oriented. What you want is:

Display
AppendImage myData

 

In reply to by chozo

chozo wrote:

Images are by default displayed starting from the top left corner, since this is how most images are oriented. What you want is:

Display
AppendImage myData

 

 

Great, thank you!