
Setting Colors of traces and a subset for legend

hegedus
Just looking to see if there is a starting point before I start from scratch on this task.
Task: I have a display that shows two sets of graphs. The same X-Axis and 2 separate Y-Axis that show data from experiments in two different ways. Nothing magical here. I use a multidimensional wave to store the data and am plotting different columns
If I look at the tracenamelist: B7;B7#1;B8;B8#1;B9;B9#1;B6;B6#1;B5;B5#1; I have the 2 traces for each data set. The traces are added via a function and the traces are basically added in pairs, i.e. B7#1 is appendedtograph immediately after B7.
Goal 1: Have the traces from the same originating data set be the same color, i.e. B7 and B7#1 are the same and B8 and B8#1 (and different from B7)...
Note there is not a defined number of sets. I use a wave widget to let the user pick the data to display and compare.
Goal 2: Create a legend with the wave symbol, but include only one instance of the pair, i.e. B7 would be included, but B7#1 would not. Since the they are the same color and represent data from the same set labeling them separately would be redundant.
I found a solution and thought I would post it for posterity's sake. I used the CommonColors function from the "Make Traces Different" code provided by Wavemetrics. Modifications:
1. Since I know the number of traces in my code I use it as input instead of using the function within the original.
2. I included a grouping variable the allows me to set the number of like colored traces.
June 12, 2009 at 08:26 am - Permalink