I have a graph and want to get the color, size etc. of the traces but am unable to do so. I tried "TraceInfo", but it is giving the same value of zColor etc. for the traces with different color on the graph. If anyone has any suggestions, then please let me know.
Thanks
Abhinav
zColor is not the color of the trace. The keyword for the trace color is rgb. Try this:
Display jack, joe
ModifyGraph rgb(joe)=(0, 0, 65535)
Print TraceInfo("Graph0", "jack", 0)
Print TraceInfo("Graph0", "joe", 0)
This prints (among other output):
rgb(x)=(0,0,65535) // For joe
Here are some functions that illustrate how to get the trace color:
String graphNameStr
String traceNameStr
Variable instance
Variable &red, &green, &blue // Outputs
String info=TraceInfo(graphNameStr, traceNameStr, instance)
String rgbStr
rgbStr = StringByKey("rgb(x)", info, "=") // e.g., "rgb(x)=(0,0,65535)
// Print rgbStr // For debugging only
sscanf rgbStr, "(%d,%d,%d)", red, green, blue
End
Function DemoColorOfTrace(graphNameStr, traceNameStr, instance)
String graphNameStr
String traceNameStr
Variable instance
Variable red, green, blue
GetColorOfTrace(graphNameStr, traceNameStr, instance, red, green, blue)
Print red, green, blue
End
You would invoke this from the command line like this:
Later . . .
I now remember that I posted a snippet on this a while ago. It's basically the same: http://www.igorexchange.com/node/875
June 15, 2011 at 10:56 pm - Permalink
June 16, 2011 at 12:04 am - Permalink