When making a graph with multiple traces or appending traces to an existing graph, it would be nice if the traces automatically got different (well-distinguishable) colors. Why do all traces start out as red? I understand that the traces can be colored using the "Make Traces Different" package, but it seems that the "Commonly-Used Colors" button in that package should be the default Igor behavior. Currently I auto-load procedures that add macro menu items & keyboard shortcuts to do this. However, I don't think a new Igor user should have to learn about either of those options to make decent-looking graphs.
It's probably partly because every user will want a different set of colors.
Another approach is to make a graph with a number of traces and your preferred set of colors, then Graph->Capture Graph Prefs. In the dialog, turn on the XY Plots: Wave Styles checkbox and click Capture Prefs.
For that reason I've written a mini-function with hard-coded colors (to keep it simple; I also have a function which applies color tables). I assign this function to a hotkey (Fxx) and have any graph colored with my favored colors in milliseconds. Maybe this would be an usable and lightweight approach for you. As for the Igor improvement, maybe a menu entry in the graph menu would not be too difficult? But then, it is probably not a good design practice to clutter menus with special-case commands on default.
Function QuickColorSpectrum()// colors traces with 12 different colors String Traces = TraceNameList("",";",1)// get all the traces from the graph Variable Items = ItemsInList(Traces)// count the traces Make/FREE/N=(11,3) colors = {{65280,0,0}, {65280,43520,0}, {0,65280,0}, {0,52224,0}, {0,65280,65280}, {0,43520,65280}, {0,15872,65280}, {65280,16384,55552}, {36864,14592,58880}, {0,0,0},{26112,26112,26112}} Variablei for(i = 0; i<DimSize(colors,1); i += 1) ModifyGraph rgb($StringFromList(i,Traces))=(colors[0][i],colors[1][i],colors[2][i])// set new color offset endfor End
It's probably partly because every user will want a different set of colors.
But having some common, sensible color choices as default would be a great start. Anyone who wants their own set of colors can utilize the functions we've been discussing and add menu items/shortcuts etc, but that's relatively advanced usage. A new Igor user shouldn't create graphs that by default are less readable than Excel graphs.
My point is that having all the traces on a chart red by default is terribly indistinguishable. For example, Mathematica makes the first two traces blue and purple, which are only barely distinguishable, but at least they're different.
Another approach is to make a graph with a number of traces and your preferred set of colors, then Graph->Capture Graph Prefs. In the dialog, turn on the XY Plots: Wave Styles checkbox and click Capture Prefs.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 25, 2016 at 12:15 pm - Permalink
String Traces = TraceNameList("",";",1) // get all the traces from the graph
Variable Items = ItemsInList(Traces) // count the traces
Make/FREE/N=(11,3) colors = {{65280,0,0}, {65280,43520,0}, {0,65280,0}, {0,52224,0}, {0,65280,65280}, {0,43520,65280}, {0,15872,65280}, {65280,16384,55552}, {36864,14592,58880}, {0,0,0},{26112,26112,26112}}
Variable i
for (i = 0; i <DimSize(colors,1); i += 1)
ModifyGraph rgb($StringFromList(i,Traces))=(colors[0][i],colors[1][i],colors[2][i]) // set new color offset
endfor
End
May 25, 2016 at 07:03 pm - Permalink
But having some common, sensible color choices as default would be a great start. Anyone who wants their own set of colors can utilize the functions we've been discussing and add menu items/shortcuts etc, but that's relatively advanced usage. A new Igor user shouldn't create graphs that by default are less readable than Excel graphs.
My point is that having all the traces on a chart red by default is terribly indistinguishable. For example, Mathematica makes the first two traces blue and purple, which are only barely distinguishable, but at least they're different.
May 26, 2016 at 11:17 am - Permalink