Text Color from Trace Color
hegedus
Hi,
I created a graph with dots as the mode and different colors for the six traces, in creating a legend the marker is very small (dot) and does not provide a sufficient visual clue to the corresponding trace. I hand coded the text of the label in the trace color, though this is not stable if the underlying trace changes.
It would be nice to have a flag to set the color based on a trace.
Andy
You could make a hook function to update the legend that runs every time the graph is updated
December 15, 2022 at 09:04 am - Permalink
Hi Andy
I've run into similar issues, and I agree it would be nice if there was a dynamic link between the legend text color and the trace color. When I had this issue I wrote a quick script to change the legend colors for me. You have to add the text color tag to each line in the legend before the script will work, and it assumes that there is only one trace per line in the legend. I haven't tested it to failure, but it worked well enough in my use cases.
December 15, 2022 at 10:17 am - Permalink
Note that you can also just set the Symbol Min Thickness in the Symbols tab of the Modify Annotation dialog to make the symbols appear larger in the legend which may avoid this issue. I often increase that size to help distinguish traces.
Legend/C/N=text0/J/H={0,5,10}
As an alternative, I agree that the proposed dynamic link between legend text color and trace color would be nice.
December 15, 2022 at 04:35 pm - Permalink
I would use a dynamic link like that in tags, if it were available.
December 16, 2022 at 03:22 am - Permalink
"It would be nice to have a flag to set the color based on a trace."
What color would you expect your text to have if the trace color was set to f(z)?
December 16, 2022 at 07:46 am - Permalink
In reply to "It would be nice to have a… by aclight
Hi,
If it is set to f(z) set text color to normal.
Andy
December 16, 2022 at 07:55 am - Permalink
If you change a trace to use f(z) as the color, the marker color in the legend is the last non-f(z) color that was selected. Maybe duplicate that behavior?
Make/O/D/N=10 Test_Wave=p
Display/W=(839,67,1550,635)/K=1 Test_Wave
ModifyGraph mode=3
ModifyGraph marker=19
Legend/C/N=text0/J/F=0/H={20,1,10}/A=MC/X=-39.30/Y=45.26 "\\s(Test_Wave) Test_Wave"
DoUpdate //Default trace color is red, legend marker color is also red
Sleep/S 3
ModifyGraph rgb=(0,0,0) //Change trace color to black, legend marker color changes to black
DoUpdate
Sleep/S 3
ModifyGraph zColor(Test_Wave)={Test_Wave,*,*,Rainbow} //Change trace color to f(z), legend marker color stays black, even though Rainbow does not have black
END
December 16, 2022 at 08:38 am - Permalink
You can show the style (including color) for one particular point in the Legend by specifying that point number:
Legend/C/N=text0 "\\s(Test_Wave[0]) Test_Wave"
That can be used to solve the f(z) ambiguity.
December 16, 2022 at 06:56 pm - Permalink