Erik Wickstrom schrieb:
> Hi all,
>
> Can matplotlib (or any other Python charting library) generate charts
> like this: (also attached if you prefer)
Here is a demo-script. The second way is inspired by matlab. Can this be
done more easily in python? Can X and Y be built more elegantly with numpy?

Armin
-------8<------------------------
from pylab import *
# data generation
x = linspace(0,10,100)
y = exp(-x)
ye = y + rand(y.size)-0.5
# plot the vertical lines
# with loop
for xl,yl,yel in zip(x,y,ye):
    plot([xl,xl],[yl,yel],'r')
plot(x,y,x,ye,'d')

# plot by separating with NaN
figure()
X = zeros((x.size,3))
Y = zeros((x.size,3))
X[:,0],X[:,1],X[:,2] = x,x,NaN
Y[:,0],Y[:,1],Y[:,2] = y,ye,NaN
plot(X.flatten(),Y.flatten(),x,y,x,ye,'d')

show()
-------8<------------------------

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to