
Unconnect waves in graph

To display a number of different waves, I use the AppendToGraph function. See the code to see how. I would like to plot currents (the Y-values) against their voltages (the X-values). The plotmode is set to lines, or lines and markers. This works fine, except for the fact that all the different current waves are connected to the previous one. I would like the individual values of each current wave to be connected, but not the waves themselves to be connected to each other.
I noticed that when I plot every current wave against one single voltage wave (in the same way) I get what I want. However, I really need to plot the current values against their own voltage value.
Is there a way to get what I want?
Function doThing() String Xwave = "meanCurrents" String YWave = "meanVoltages" String current_waves = "Current" Variable index = 0 String graphicName = "IV_Plot" String these_Waves = WaveList(current_waves + "*",";","") do // for every wave to add String /G this_wave = StringFromList(index, these_Waves) if (strlen(this_Wave) == 0) break else plotGraph(graphicName, Xwave, Ywave, index) endif index += 1 while(1) end //#################################################### Function plotGraph(graphName,the_wave, the_xaxis ,i) String graphName String the_wave String the_xaxis Variable i if (i ==0) display /N=$(graphName) $the_wave vs $the_xaxis else AppendToGraph /W=$(graphName) $the_wave vs $the_xaxis endif end
Olav
If that's the case, your code might be confused. You're using the wave "meanCurrents" for your Xwave and "meanVoltages" for your Ywave. You might have these switched.
Also, you iterate through theseWaves one at a time, but then you don't do anything with thisWave. I assume you'd need to pass that to your plotGraph() function as a parameter, but instead you're passing xWave, Ywave each time, and since the value of those strings isn't changing in the do...while loop you're probably not getting what you'd expect.
October 28, 2008 at 11:25 am - Permalink
The code is actually a little more complicated than I posted. I tried to isolate the part that (i thought) generated the weird graph. I attached the graph now. I probably screwed up 'simplifying'. Below is the complete code, as it is actually working in Igor.
You can also see that the first time 'plotGraph()' is called, it uses the same X-axis every loop.
I alos attached two .txt files that I use to try this script.
Thanks for all your advice. I really appreciate it!
Olav
October 28, 2008 at 01:26 pm - Permalink
It's amazing the stuff that you can do with Igor Pro! I am still only in the trial period, but the interface, flexibility and capabilities are really impressive. To me, it's no match for Origin (the software that is mainly used at the lab where I work). And I have a feeling I am now merely using some pretty simple functionalities.
Again, thanks for the input.
Here's my fix: (I'm sure all these could be done a lot more elegant, but I wanted to write this quickly just so I know what I can do with Igor)
was replaced by:
October 28, 2008 at 02:34 pm - Permalink
It looks like your problem is that your X values (voltage values) are not in numerical order. Therefore, Igor just connects the dots, and your graph looks wrong.
To fix this, you'll want to sort both your current and voltage waves, using the voltage wave as the key. You can do this by going to Analysis->Sort, and chose the voltage wave in the left list box and both the voltage and current waves in the right list box. The Igor command to do this should look like the following:
Is this the output you're looking for?
October 28, 2008 at 02:56 pm - Permalink
As a note, the LinkDisplay routines found here might be useful to you. They allow you to use a "simpler" nomenclature to display (x,y) wave pairs. For example, if you want to display all waves in the current folder found by a search of "Current*" against a wave called Time1, you could do this ...
HTH
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
October 28, 2008 at 04:01 pm - Permalink