08-02-2012 02:22 PM
I need to plot power/current vs temperature on a graph from data collected by another program. The program runs from -10C to 60C, back to -10C, then goes to 60C, and finally returns to 25C. The collecting program stores time, temperature current, and power.
I would like to plot power/current on the y axis and temperature on the x axis, but maintain the time reference. Basically I would like to see the x axis read
-10 -5 0 5.....55 60 55.....5 0 -5 -10 -5 0 5.....55 60 55...25
When I use PlotXY or PlotLine the x axis plots -10 60 and the y axis plots back on itself.
We can do the graph in Excel and have attached a pdf of a plot.
Solved! Go to Solution.
08-02-2012 03:49 PM
I have not tried it myself but maybe you could use InsertAxisItem () ? You would need to set the ATTR_XUSE_LABEL_STRINGS attribute to TRUE
08-15-2012 02:02 PM
InsertAxisItem did not fix my problem.
08-16-2012 05:45 PM
Hi Paul,
Do you have two separate data items for the x-axis, namely a set of temperature data which is associated with a set of time data? Are these two independent arrays of points?
08-17-2012 08:26 AM
I have two arrays. One array is for the x axis and has the temperature data. ( -10 ...0....60....0...-10) The other array is for the y axis and has the power measurement taken at the temperature. Both arrays are index with a common point and are the same size.
Paul
08-17-2012 08:56 AM
@Paul Knight wrote:
InsertAxisItem did not fix my problem.
Why not? In the mean time I have tried it myself and it seems to be working...
Let's assume that you are using PlotY for the indexed power values, then you could use something like
InsertAxisItem (panel, PANEL_GRAPH, 0, 0, item_label [0], 0.0 );
InsertAxisItem (panel, PANEL_GRAPH, 0, 10, item_label [10], 10.0 );
...
to label every tenth's value, with item_label being your temperature values converted to char*. This way any non-linear axis can be simulated, no?
08-17-2012 11:01 AM
The graph puts all the minus temperatures and their label to the left of zero. The graph that I am trying to emulate from Excel has along the x-axis each value taken in order, so we start at -10 ..... 0 ..... 60 ..... -10. So there are minus temperatures to the right of the +60 temperature. InsertAxisItem only inserts the label where the graph will be putting the data, it does not effect where the data gets put.
08-17-2012 01:41 PM
@Paul Knight wrote:
The graph puts all the minus temperatures and their label to the left of zero.
Paul,
I am not sure I got you right - could it be that you didn't read my post carefully enough? In the line
InsertAxisItem (panel, PANEL_GRAPH, 0, 10, item_label [10], 10.0 );
the 10.0 is not meant to be your temperature, but the (double) index of the respective array element. This way the x axis values of your graph are monotonously increasing from left to right, but nobody knows because the x-axis values are labeled with your temperature values... So if your tenth temperature is +20 and your twentieth temperature is -60 degrees, it will be displayed in that order and the graph will not put 'the minus temperatures and their labels to the left of zero'
(One might argue that item_label [ 10 ] should read item_label [ 9 ] but this is a cosmetic issue...)
08-17-2012 02:08 PM
Need trick. It now works.
08-17-2012 02:13 PM
Ah, I am glad, have fun!