Xrockyman Posted July 30, 2008 Report Share Posted July 30, 2008 Dear users, The example below It's me trying to plot an XY Graph. The first plot all appears as I want because the 'x' is by order (1,2,3,4, etc). I want that the second plot to exactly the as the first but I only want that x shown in this plot is 22, 23, 0, 1, etc. The issue here is that labview reorder my x. I tried to put also the array on top of the graph but this is not a "clean" solution. Sorry about my bad English but I think the picture will be clear what is my objective. Regards, Sylvain. Quote Link to comment
shoneill Posted July 30, 2008 Report Share Posted July 30, 2008 Sylvain, LabVIEW isn't re-ordering anything, you are. The graphs look more or less correct for what you're showing. What do you think the graph SHOULD look like? Shane. Quote Link to comment
Xrockyman Posted July 30, 2008 Author Report Share Posted July 30, 2008 QUOTE (shoneill @ Jul 29 2008, 03:30 PM) Sylvain,LabVIEW isn't re-ordering anything, you are. The graphs look more or less correct for what you're showing. What do you think the graph SHOULD look like? Shane. All I want to do It's the second plot to be exactly the same as the first one except the time time axle. I want the time axle time shows the same values and in the same order that the array below. Thanks. Quote Link to comment
Norm Kirchner Posted July 30, 2008 Report Share Posted July 30, 2008 I'll try to get through what's lost in translation. The only way that you would be able to have both graphs show the same thing but shifted on the time axis is to have the same ordering of the x elements you have 1,2,3,4,5,6 if you want to start at 22 then the second graphs x axis should be 22,23,24,25,26,27 but instead you skip from 23 back to zero.. why? Quote Link to comment
mross Posted July 30, 2008 Report Share Posted July 30, 2008 QUOTE (Xrockyman @ Jul 29 2008, 10:04 AM) Dear users, The example below It's me trying to plot an XY Graph. The first plot all appears as I want because the 'x' is by order (1,2,3,4, etc). I want that the second plot to exactly the as the first but I only want that x shown in this plot is 22, 23, 0, 1, etc. The issue here is that labview reorder my x. I tried to put also the array on top of the graph but this is not a "clean" solution. Sorry about my bad English but I think the picture will be clear what is my objective. Regards, Sylvain. For us to be more helpfull the block diagram or the actual VI is better to share. Without that information, I can only give the simplest advise. An XY graph requires an array of ordered pairs to make a plot. After all there is no regular increment between x points so you must provide the x datum information for each and every y datum. (x1, y1), (x2, y2)...(xn,yn) is the mathematical form, but the requirement is for a 1D array of x "bundled" with an 1D array of y --> (x1, x2, ...,xn) and (y1, y2, ..., yn). If you did not get the plot you desired you have only to look at the ordered pairs you sent to the graph to see that it plotted exactly what you told it to. This becomes a little more complex when you wish to plot more than one set of ordered pairs to a single graph - a multi-plot XY graph; but without any failure, if you provide the information in the correct format, and in the correct order you will get what you asked for. If you bring you cursor over the XY graph icon on the block diagram and the context help of LabVIEW is activated, you will see a brief descrition of what it takes to creat a single XY, and a multi XY graph. The multi XY graph is simply an array of valid multiplot XY data: Ordered pairs: (x1, y1), (x2, y2)...(xn,yn) and (a1, b1), (a2, b2)...(an,bn) are formatted to: 1d array [x1, x2, ...,xn] = [x] shown as a bold orange line 1d array [y1, y2, ...,yn] = [y] AND 1d array [a1, a2, ...,an] = [a] 1d array [b1, b2, ...,bn] = bundle 1D arrays together you have: {[x],[y]} = {x,y} bundle shown as a purple ladder shaped line and {[a],} = {x,y} bundle then create a single array of 2 bundles: [ [x,y}, {a,b} ] shown as a purple line with diagonal ladder rungs mike Quote Link to comment
TobyD Posted July 30, 2008 Report Share Posted July 30, 2008 QUOTE (Xrockyman @ Jul 29 2008, 07:48 AM) All I want to do It's the second plot to be exactly the same as the first one except the time time axle. I want the time axle time shows the same values and in the same order that the array below. Thanks. If you look at what you are sending to the XY graph you will see that all of the points are being plotted correctly. I do not understand why you think this is incorrect. http://lavag.org/old_files/monthly_07_2008/post-8758-1217346052.png' target="_blank"> Quote Link to comment
Xrockyman Posted July 30, 2008 Author Report Share Posted July 30, 2008 QUOTE (TobyD @ Jul 29 2008, 04:42 PM) If you look at what you are sending to the XY graph you will see that all of the points are being plotted correctly. I do not understand why you think this is incorrect. http://lavag.org/old_files/monthly_07_2008/post-8758-1217346052.png' target="_blank"> Imagine that 'y' values for example represents temperature of something, and my 'x' axis represent time in hours. If for example now are 4H the axe 'x' for the last 6 hours will be 22, 23, 0, 1, 2 ,3, . Labview attributed the points correctly but reordered the 'x'. Thanks. Quote Link to comment
eaolson Posted July 30, 2008 Report Share Posted July 30, 2008 QUOTE (Xrockyman @ Jul 29 2008, 11:09 AM) Imagine that 'y' values for example represents temperature of something, and my 'x' axis represent time in hours. If for example now are 4H the axe 'x' for the last 6 hours will be 22, 23, 0, 1, 2 ,3, . Labview attributed the points correctly but reordered the 'x'. LabVIEW did not reorder anything. Your points are correctly plotted at (22,4) (25,3) (0, 2) (1, 36), etc. If you look at where the points on your graph are location, you will see they are indeed at those (x,y) coordinates, just as you told LabVIEW to do. I suspect your complaint is that the lines connecting the points are drawn unexpectedly. You probably want the lines to connect the points in ascending x-axis order. LabVIEW is connecting the points in the order that the array is in. Right now, your lowest x-axis coordinate is on point #3, so you have a line connecting point #2 (x=25) with point #3 (x=0). You need to sort your array over the x-coordinate. If that's not your intent, you need to describe your problem better. Quote Link to comment
Francois Normandin Posted July 30, 2008 Report Share Posted July 30, 2008 QUOTE (Xrockyman @ Jul 29 2008, 12:09 PM) Imagine that 'y' values for example represents temperature of something, and my 'x' axis represent time in hours. If for example now are 4H the axe 'x' for the last 6 hours will be 22, 23, 0, 1, 2 ,3, . Labview attributed the points correctly but reordered the 'x'.Thanks. You can have "Time Stamp" be wired to X axis instead of Numeric. This way you get the X-array in ascending order of absolute or relative time and you'll get consistent representation when changing date. http://lavag.org/old_files/monthly_07_2008/post-10515-1217351226.png' target="_blank"> Quote Link to comment
Doon Posted July 30, 2008 Report Share Posted July 30, 2008 Hi Sylvain, It sounds like you need to setup your x-axis as a time stamp. In the graph's properties, under "Format and Precision", set the x-axis to "Absolute Time". Then select Advanced editing mode option and set the Format string to %<%H>T. This should make the sequence as you want it. Then you have to adjust your x-values into the correct time-stamp sequence. You have to offset the array by 7 hours and multiply by 3600 (this is due to storage of time in seconds from 17:00T1903-12-31). This would produce an x-axis that will wrap around in 24-hour intervals. The only problem with this is that you must change the format of your incoming x-data into a linear sequence (...,21,22,23,24,25,...). As everyone has stated above, the XY graph is plotting in the data as it is given in the sequence it is given. An alternative solution may be to use a waveform graph and adjust the x-axis offset to align with your data (again, using absolute time-stamp for the x-axis). have a nice day, --H Quote Link to comment
TobyD Posted July 30, 2008 Report Share Posted July 30, 2008 QUOTE (normandinf @ Jul 29 2008, 10:03 AM) You can have "Time Stamp" be wired to X axis instead of Numeric. This way you get the X-array in ascending order of absolute or relative time and you'll get consistent representation when changing date. It's amazing how simple a solution can be once we understand the problem :thumbup: Quote Link to comment
Xrockyman Posted July 31, 2008 Author Report Share Posted July 31, 2008 QUOTE (TobyD @ Jul 29 2008, 06:20 PM) It's amazing how simple a solution can be once we understand the problem :thumbup: Lol, that's wright, my bad English and my intent to have a general, not so specific solution did not help very much with the understanding of my problem. Thanks to you all, I have now the perfect solution for my problem. Regards, Sylvain Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.