On Wed, Mar 17, 2010 at 9:29 PM, Vincent Davis <vinc...@vincentdavis.net>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?
>

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()



-- 
Gökhan
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to