Category plot with two axes
txl35
I know if you add a trace to the existing y-axis, then Igor will appropriately put a bar for each trace within each category, and then you can change the category/bar gaps to adjust the graph appearance. But if the two traces require two separate y-axes and you add a new trace to the graph with a new y-axis, then it seems that Igor will only plot the traces overlaid. Is this true? The category/bar gap adjustment is not helpful here because both bars are always centered in the category. I can't seem to find a way to separate out the bars, or tell Igor to plot the left axis data points in the first 50% of each category and the right axis data points in the second 50%. I tried to play around with the x-scaling of each wave, but that only seemed to produce unpredictable results.
I will probably just end up plotting the data differently, with the categories being the parameters quantified ('Amplitude' and 'Area') and the data sets/series plotted instead would be '10ms', '20ms', and '30ms'. However, I'm really surprised that I can't find a way to plot the data as I described above, and maybe I'm just missing something simple! If anyone has any thoughts it would be very much appreciated.
Thanks,
Tom
One way to "fool" Igor into doing what you want might be to create a wave with three NaNs and plot a second category trace on each Y axis. By adjusting the order of the traces (first trace for one axis, second trace for the other) you should be able to fake the look you want. The traces with NaNs will reserve the space for the trace on the other axis.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 19, 2013 at 08:47 am - Permalink
make y1={1,2,3}
make y2={3,2,1}
y2*=1e-6 // makes the right Y axis cover a different range
make yspace={nan,nan,nan}
And commands to create the graph with the various traces on the correct axes:
AppendToGraph yspace vs xdata
AppendToGraph/R yspace vs xdata
AppendToGraph/R y2 vs xdata
Then I altered some axis and trace properties to make it clear which trace goes with which axis. I think this last bit is a potential problem with the technique.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 19, 2013 at 08:57 am - Permalink
It works, thank u
March 23, 2021 at 07:44 pm - Permalink
Here's another alternative we have used. Category plots do have x-values, sort of, so you can use an x-offset on the waves, on the order of ±0.2. Then make the bars narrow by increasing the category gap (the default is pretty fat, anyway).
For example:
make /t labels
val1 = {1, 2}
val2 = {2, 1}
labels = {"ctrl", "expt"}
Display val1 vs labels
AppendToGraph/R val2 vs labels
ModifyGraph offset(val1)={0.2,0},offset(val2)={-0.2,0}
ModifyGraph catGap(bottom)=0.7
SetAxis/A/E=1 left
SetAxis/A/E=1 right
Hope that formats okay.
-Matthew
March 24, 2021 at 11:30 am - Permalink