09-18-2015 11:49 AM
I have a plot that's got a red line on it, which is the flow rate of some pump. The pumps have a maximum flow rate, and I'd like to turn the points pink when this is hit, and back to red when it's below. How would I accomplish this programmatically?
Solved! Go to Solution.
09-18-2015 11:56 AM
09-18-2015 11:58 AM
09-18-2015 12:04 PM
09-18-2015 12:05 PM - edited 09-18-2015 12:05 PM
Hi math,
I'd like it to programmatically change the colors
It's a property of the plot, so you can access it programmatically!
It's already got 4 curves, and I don't think the legend will allow for any more
The legend will allow as many plots as you like to use!
You can even have more plots than are shown in the legend…
As Mike said: use a different plot for your pink values!
09-18-2015 12:32 PM
09-19-2015 03:56 PM
09-21-2015 11:05 AM
Is this program just for your use?
If other people will be using it, and the flow rate is a critical thing, I'd suggest something a little less subtle than changing the line from red to pink.
09-21-2015 11:08 AM
Also, you can use the plot.color property. I'm not sure how it would work if you had another graph that was only written to when the alarm was triggered, maybe mike or gerd can explain that.
09-21-2015 12:58 PM
Are you trying to have a single point plot (or, I suppose, line plot) with some points one color (say, Green) and other points another color (say, Red)? "You can't do that" -- the color of a plot is set for the entire collection of points.
Except that you can "cheat". I had a behavioral test I was programming, where I wanted to plot the Stimulus Value in Green if the response was Correct, and in Red if the response was Incorrect. Here's how I did it.
Start by declaring two arrays to hold the values (I'll call them "Right" and "Wrong"). Set the color of Right to (say) Green, the color of Wrong to Red. Right and Wrong were "fed" by I32 variables, but I declared the Arrays as Array of Dbl (you'll see why in a minute).
During a Trial, you get a Response (to be plotted) and a Boolean that says if the response is Right or Wrong. If the response is Right, set the Right plot to Value, and the Wrong plot to NaN (Not a Number), and do the reverse if the response is Wrong (i.e. make Right the NaN value). This uses the "trick" that NaN values are simply not plotted, so the two Plots (of different colors) share the same "plot space", only one Value being plotted for each Response.
Hope I explained that clearly ...
Bob Schor