Zgrid flawed?

Found a bug? Tell us about it here

Moderator: DPlotAdmin

Post Reply
BenB
Posts: 5
Joined: Wed Jan 02, 2008 7:45 am

Zgrid flawed?

Post by BenB »

Hi,

I'm mapping data using the zgrid plots, and I noticed that the data always seems elongated along the bottom-left to top right diagonal. It is particularly visible when you use shaded bands instead of contour lines. Plotting my data with Excel's surface plot doesn't show such a trend.

To find out what was going on, I plotted a map of random numbers using zgrid and found the same trend! Worse still, I swapped all the columns of my data so as to effectively get a vertical mirror version of this random map, and found that the data was still elongated along that same bottom-left to top right diagonal.

Seems to me that the algorithm used interpolate the contour lines between the data points is possibly flawed. Which is a pain because zgrid is the only reason why I bought DPlot. If this cannot be corrected, zgrid is basically useless to me...

Thanks in advance for your help,

Ben
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Ben,
Thanks for your input. If you select Options>Contour Options and check "Borders" under "Draw" you can see what's going on there. Here's the first example from your e-mail:
Image

DPlot uses your X and Y to generate a triangular mesh. All triangles are considered planar. Because of the way the mesh is divvied up, many contour lines will tend to run at 45 deg. to the X axis.

This will be less noticeable with more data. I'd suggest using Options>Generate Mesh but I tried that with your random data this morning and the bivariate interpolation scheme has fits with it, presumably because of the roughness. I either get complete nonsense or it bombs - so that command definitely needs work and I'll be looking at that as soon as possible.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

After giving this a bit of thought I decided I've been lazy with the ZGrid AddIn command. DPlot has two different setups for surface plots: randomly-spaced points and points on a rectangular grid with constant spacing in X and Y. The latter generally produces better looking contour plots for the same data. The ZGrid command, though, passes X,Y,Z triplets to DPlot as if they're random points with no consideration given to whether the points are on an evenly-spaced grid. So I changed it... if your table has evenly spaced X and Y values and there are no empty Z cells, then you'll now get points on a rectangular grid. You can get the new Add-In here: http://www.dplot.com/excel/addin_setup.exe.

The result, with your data:
Image

And here's a side-by-side comparison between Excel's surface plot (on the left) and DPlot's plot with the same colors/levels:

Image

They are similar but not identical; Excel is obviously interpolating differently than DPlot. I don't know exactly what it is doing but I don't think I can say that one is better or more accurate than the other.

I haven't yet found why "Generate Mesh" has such a problem with your example; still working on it.
Visualize Your Data
support@dplot.com
BenB
Posts: 5
Joined: Wed Jan 02, 2008 7:45 am

Post by BenB »

Great, that's exactly what I was looking for!

Thanks very much!

Ben
Post Reply