On Wed, Apr 29, 2009 at 08:20, Joseph Smidt <[email protected]> wrote:
> 1. Both graphs overlayed on the same plot.
> 2. Semilogy. (log y values),
> 3. Only ploy for x in the range 2-3.
> 4. Legend for the two graphs on same plot.
a simple example:
In [2]: import numpy as np
In [3]: import matplotlib.pyplot as plt
In [16]: data = np.random.rand(10,3)
In [17]: data
Out[17]:
array([[ 0.00669083, 0.4421283 , 0.46697081],
[ 0.18093819, 0.11669917, 0.70887601],
[ 0.11659791, 0.96514955, 0.07389404],
[ 0.95616662, 0.30350482, 0.10036185],
[ 0.14197553, 0.10560376, 0.2964961 ],
[ 0.74705585, 0.21806946, 0.37095176],
[ 0.1551145 , 0.76093425, 0.878701 ],
[ 0.44315466, 0.3625146 , 0.06750168],
[ 0.96109656, 0.88401174, 0.59215722],
[ 0.46190334, 0.39079641, 0.5958516 ]])
In [28]: plt.semilogy(data[:,0], data[:,1], label='first dataset')
Out[28]: [<matplotlib.lines.Line2D object at 0xa7698ac>]
In [29]: plt.semilogy(data[:,0], data[:,2], label='second dataset')
Out[29]: [<matplotlib.lines.Line2D object at 0xa8049ac>]
In [30]: plt.xlim([0.2, 0.8]) # limit x to 0.2..0.8
Out[30]: (0.20000000000000001, 0.80000000000000004)
In [31]: plt.legend()
Out[31]: <matplotlib.legend.Legend object at 0xa80d04c>
In [32]: plt.show()
> I have spent time looking through the documentation but I can't find
> anyway to do this is any straightforward way. plotfile() looks
> promising, but I can't seem to make it do the above. Thanks in
> advance.
to load data from file you can try
matplotlib.mlab.csv2rec
Cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users