Initial contour data is 0,0,0 rather than my data.

Q&A for Visual Basic, Visual Basic .NET, and PowerBasic developers using DPlot

Moderator: DPlotAdmin

Post Reply
PCJimmmy
Posts: 12
Joined: Mon Jan 12, 2009 3:37 pm

Initial contour data is 0,0,0 rather than my data.

Post by PCJimmmy »

I built a VB.2008 application based on the VB project1 example. I create the dataset of values. When Dpot generates the contour plot my initial data value becomes the 2nd data item, with 0,0,0 as the first. I have confirmed that i is equal to zero when the first node values are set.
code for setting the node values is
Node(i, 0) = yy
Node(i, 1) = J
Node(i, 2) = ROC
i = i + 1
241, 482 and 0.5 are the values for i = 0 with the plot I am generating.

After all the node values are created I generate the contour plot.
cmds = "[Caption(" & Chr(34) & "Reflective Distortion " & Chr(34) & ")]"
cmds = cmds & "[ContourAxes(1)][ContourGrid(0)][ContourLevels(20,0,1)][ContourMethod(0)]"
cmds = cmds & "[FontPoints(1,10)][FontPoints(6,10)][DocMaximize()]"
cmds = cmds & "[ZAxisLabel(" & Chr(34) & "z" & Chr(34) & ")]"
ret = DPlot_Plot8(d, 0, Node(0, 0), cmds)


When the plot is generated the first set of data points is 0,0,0 with the 2nd set being my values of 241, 482, 0.5. In Dplot I can of course delete that first row (edit data) and get the correct contour plot - but I sure don't want to have to manualy delete that row for every plot I generate.

How do I avoid that first data point set being 0,0,0 ?
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Just a guess, but my guess is that all of your X values are greater than 0, and you're initializing 1 less than d.MaxPoints triplets. DPlot initially sorts your data in ascending X, then Y, then Z order to speed up several operations. So if all of your X values are > 0 you'd get 0,0,0 for the first point.
Visualize Your Data
support@dplot.com
PCJimmmy
Posts: 12
Joined: Mon Jan 12, 2009 3:37 pm

You Nailed It

Post by PCJimmmy »

All values were greater than 0 - a lot of them were 0 so I did have the option to make one of them negitive, but did not need to go to that workaround.

I am processing photographic images so my d.maxpoints was set to the width*height of the image. But I don't act on all the pixels in the image or want to plot them, in fact, only plotting about 1/2 them. So my number of values in the dataset was a whole lot less than d.maxpoints. Since I do know how many datavalues I have (i), changing the d.maxpoints assignment to the following did the trick.

d.maxpoints = i

Thanks for the help
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

You're welcome, and I'm glad this worked out.

Just to clarify on what I said previously, and which didn't occur to me until I saw this: "So my number of values in the dataset was a whole lot less than d.maxpoints. ": DPlot will throw away points with identical X & Y values, keeping the maximum Z. So you'd only ever see one (0,0,0) regardless of how many points fewer than d.Maxpoints you were initializing.
Visualize Your Data
support@dplot.com
Post Reply