Bidirectional Category Plot

Is there a way to make a bidirectional category plot in IGOR? An example of what I'm thinking of is attached below.

Bidirectional category plot example Example two

Hi,

I played around with this using category plots and a dedicated left axis.  My process:

1. Create a the basic category plot with both sets of data and the text labels wave.

2. Offset the second wave by -0.5 in the x to align them.

3. Double click in the corner of the graph to bring up the modify graph dialog box and select "Swap X & Y"

4. Modify axis to show zero line on axis.

 

Window Graph0() : Graph
    PauseUpdate; Silent 1       // building window...
    Display /W=(676,200,1507,631)/L=test fred,lucy vs ethyl
    ModifyGraph rgb(lucy)=(19675,39321,1)
    ModifyGraph offset(lucy)={-0.5,0}
    ModifyGraph zero(test)=1
    ModifyGraph lblPos(bottom)=35
    ModifyGraph freePos(test)=0
    ModifyGraph swapXY=1
EndMacro

 

Andy

hello, 

Here, I extend a question:  how to adjust the location of the grids?

 

thank you all.

The key is to double-click the first trace on the graph to bring up the Modify Trace dialog. With the first trace in the list selected, from the Grouping popup near the bottom of the Properties list, select "Keep with next". That will plot the bars for both traces in the same slot in the category plot.

To adjust the space between the bars, double-click the category axis to bring up the Modify Axis dialog. On the Axis tab, set the Category Gap.

There appears to be no way to get the standard axis grid lines to be centered on the category label. You could use draw tools to add lines to the graph in the appropriate places. As long as you don't offset the bars as recommended by Andy Hegedus, you can use axis coordinates to place the lines on the category plot; the space between the first and second bars is at X=1. To center lines on the bars, draw at X=0.5, 1.5, etc.

To learn more about category plots and the grouping modes: DisplayHelpTopic "Stacked Bar Charts". There's a lot of detailed info in the Category Plots help file: Help->Help Windows->Category Plots.ihf.

Oh, yeah- I recommend doing the manipulations *before* you apply the SwapXY to make the bars horizontal.

In reply to by johnweeks

How about plotting two category plots each covering half of the width of the plot. This way the 'bottom' axis can go positive in each direction. Something like this:

Function DoStuff()
    Make/O/T/N=5 myCatNames = {"abc", "def", "ghi", "jkl", "mno"}
    Make/O/D/N=5 myData1 = {2, 4, 3, 1, 5}
    Make/O/D/N=5 myData2 = {3, 2, 1, 5, 2}
   
    Display myData1 vs myCatNames
    ModifyGraph swapXY=1
    ModifyGraph axisEnab(bottom)={0.50,1}
    SetAxis bottom 0,5
   
    AppendToGraph/B=bottom2 myData2 vs myCatNames
    ModifyGraph axisEnab(bottom2)={0,0.50},freePos(bottom2)=0
    SetAxis/R bottom2 5,0
    ModifyGraph rgb(myData2)=(0,0,52224)
End