Category plot with two axes

Does anyone know if there's a way to create a category plot with two separate y-axes that use the same category x-axis but where the traces do not overlay? Let's say that I have three different categories (in my case they are three different pulse widths: 10ms, 20ms, and 30ms), and for each of those categories (pulses) I have two different features I would like to show (again, in my case they are the averaged amplitude and integrated area from the response to the aforementioned pulses). I want the amplitude axis on the left, the area axis on the right, and two bars in each category with the left bar corresponding to the left axis and the right bar to the right axis. A pattern on the bar would be used to indicate which axis it belongs to.

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.


When you use two Y axes, the traces don't know about each other.

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.
After I posted my reply I got cold feet about the solution, so I tried it. Here are commands I used to make fake data:
make/t/N=3 xdata = "col "+num2str(p)
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:
Display y1 vs xdata
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.

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 val1, val2
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.