AppendBoxPlot
I am attempting to make a box Plot in Igor 9. The functionality almost nearly does what I need, but I am struggling to get to the last step. I have four separate waves, each a different data set, and I want to look at side by side box plots.
Using some test data (see code below) I was able to make each data set a different color.
My last step - is there a way to make a legend with the correct color for each data set?
Ideally I would like to have these as independent waves that I can manipulate colors, legends, etc., so if there is a better way to accomplish this, I am open to other routes.
Alternatively, is there a way to get the axis labels to match the color of each data set?
Make/D/O/N= 100 test1 = 100+enoise(20)
Make/D/O/N= 100 test2 = 105+enoise(25)
Make/D/O/N= 100 test3 = 95+enoise(15)
Make/D/O/N= 100 test4 = 120+enoise(30)
Make/T/O/N = 4 Namewave_BP = {"test1", "test2", "test3", "test4"}
Display
AppendBoxPlot test1,test2,test3,test4 vs NameWave_BP
ModifyGraph mode=4
ModifyBoxPlot trace=test1,boxWidth=0.75,boxFill=(65535,0,0,3000),dataColor=(65535,0,0)
ModifyBoxPlot trace=test1,jitter=0.5,notched
ModifyBoxPlot trace=test1,boxFill[1]=(2,39321,1,3000),dataColor[1]=(2,39321,1)
ModifyBoxPlot trace=test1,boxFill[2]=(1,16019,65535,3000),dataColor[2]=(1,16019,65535)
ModifyBoxPlot trace=test1,boxFill[3]=(36873,14755,58982,3000),dataColor[3]=(36873,14755,58982)
For the axis label colors, you should be able to specify the color in the text wave, like this:
Similarly for the legend, you'll have to express the colors explicitly. This does seem to be a limitation specific to box and violin plots. Normally the legend will adopt the color of trace, but in this case it only seems to apply to the color of the first category. Note that each marker has both a stroke and fill color in this example:
In general, you should be able to write a function that uses a lookup text wave to apply these properties to your graph.
I'll put a ticket in for the legend colors in box/violin plots.
October 26, 2026 at 03:03 pm - Permalink