LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inserting point onto graph


I'm looking to attach a different colored point onto a graph - ideally a waveform graph, but if not possible, then an XY graph, that has an existing plot on it. I can't seem to do it !?
Attached is a VI where an image is loaded, a line profile is created, & the resulting plot is displayed. The points making up this plot are colored red. I'd like to add a point at coordinates (A,B) & color it some different color.
It doesn't seem to do that ! It would be great if there was a graph property node that will add a point.

The VI will prompt you for an image - you can use the simple tiff file I've attached.

I'm dreaming of a simple way to do this for a waveform graph -
Any help would be greatly appreciated !

Thanks,
ak

Download All
0 Kudos
Message 1 of 14
(3,478 Views)
You just need to graph two plots.
 
 
Make sure to select an appropriate display for the second plot so it contains points (by defaults it's a line graph and won't show a single point graph very well).
 
 

Message Edited by altenbach on 03-07-2007 02:24 PM

0 Kudos
Message 2 of 14
(3,458 Views)
Another possibility would be to omit the second plot and simply place a suitably decorated cursor programmatically to the desired location.
 
Since you have LabVIEW 8.0 or higher, you can also use the "plot.images" property to draw anything you want on the graph using picture commands. Check the examples.
0 Kudos
Message 3 of 14
(3,455 Views)
Yes - I see. Thank you, I've got the point desired added onto the graph as a cursor. My goal is to input an array of points (not just one) & have these points appear simultaneously. These arrays are small (5 or 6 element).
I tried using cursor index property but can't get it working.  Attached is where I'm stuck - if you route the cluster output from the 2 points (A,B) & (C,D) into cursor position, the problem appears.

ak

Download All
0 Kudos
Message 4 of 14
(3,441 Views)

Because it sounds like you will adding different amounts of points each time I would suggest using the Cursor List property or use anotations.

Either way you can build up the array of cursors or annotations, setting their position, color, style, etc. and then set the property and you are done.

0 Kudos
Message 5 of 14
(3,431 Views)

If you have a large or variable amount of points to add, use my first method instead of cursors!

Simply use a "built array" node to add the two clusters before going to the graph terminal.

(Notice that you did not copy my code correctly. For the X array, you need to tap into the output BEFORE the "add" function inside the FOR loop, else your x-array is shifted by dx and the first point in the array is "x0+dx" instead of "x0" as it should be.

0 Kudos
Message 6 of 14
(3,423 Views)

Yes - I think I'm close !!  But I don't understand why only the first cursor is plotted ?

ak

0 Kudos
Message 7 of 14
(3,421 Views)

You only have one cursor defined, thus your cursor list only contains one element, thus the loop runs only once!

Remember that you don't need to wire all unmodified elements across, just the changed elements IF you wire the input cluster when you bundle. Also, if you use "bundle by name" you need to only show the useful elements.

Why do you think you need to jump through all these hoops for the coordinates (make array..replace array element..index array) just to get the original input back??? 😮

Anyway, here is one possibility:

This assumes you have the first cursor defined. In hte more general case, just use a cursor cluster diagram constant instead of reading the cursor list and indexing the first element.

 

Message Edited by altenbach on 03-08-2007 08:43 AM

0 Kudos
Message 8 of 14
(3,414 Views)

cig438 I think there is some confusion about what you want.  Do you want a single point added or a bunch of points added?  Do you want every point to have a different color, are do you simply want 5 or 6 points added all the same color?

If you want to add 5 or 6 same colored points then use Altenbachs code.  If you want every point to have a different point you will need to do something different.

0 Kudos
Message 9 of 14
(3,408 Views)
Here is a safer alternative that even works if you don't have any cursors defined. Makes sense?
 
 
(To create the cluster diagram constant, simply right-click on the wire containing a cursor list element (e.g. after the index array in the previous image) and select "create constant".)

Message Edited by altenbach on 03-08-2007 08:54 AM

0 Kudos
Message 10 of 14
(3,406 Views)