I am doing a fairly basic plot plot(ydata) but would like to condition the marker on another array, for example if I have ydata and markerdata then for markerdata > 0 use use a ‘+’ and for markerdata <0 use a ‘-’ and for markerdata = 0 ‘.’
How do I do this?
Vincent Davis
720-301-3003
vincent@...3029...
my blog |
LinkedIn
This is my solution. The main idea is based on using numpy array masking.
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(100)
a = np.arange(-50,50)
plt.plot(x[a>0], a[a>0], “+”)
plt.plot(x[a==0], a[a==0], “.”)
plt.plot(x[a<0], a[a<0], “–”)
plt.show()
···
On Wed, Mar 17, 2010 at 9:29 PM, Vincent Davis <vincent@…3029…> wrote:
I am doing a fairly basic plot plot(ydata) but would like to condition the marker on another array, for example if I have ydata and markerdata then for markerdata > 0 use use a ‘+’ and for markerdata <0 use a ‘-’ and for markerdata = 0 ‘.’
How do I do this?
–
Gökhan