Hi, I'd like to plot my data and indicate where the
> instrument I used actually actually should truncate
> those data. My idea is to have y values from zero to a
> certain maximum and to draw a red line from zero to the
> lower limit, then to continue with this line colored in
> black, and finally end this very line colored red from
> the upper limit to the maximum of my data. How is this
> to accomplish?
Sorry for the delay in answering this. I am not 100% sure I
understand your question, but it appears to me that you want to color
a line differently depending on it's y value. You can do this with
masked arrays, which are supported in matplotlib CVS
import matplotlib.numerix.ma as ma
from matplotlib.numerix import logical_or
from pylab import plot, show, arange, sin, pi
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
upper = 0.77
lower = -0.77
supper = ma.masked_where(s < upper, s)
slower = ma.masked_where(s > lower, s)
smiddle = ma.masked_where(logical_or(s<lower, s>upper), s)
plot(t, slower, 'r', t, smiddle, 'b', t, supper, 'g')
show()
Another approach, which will work with any recent matplotlib
(including 0.71), is to use a shaded region to indicate your ranges.
from pylab import plot, show, arange, sin, pi, axhspan
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
upper = 0.77
lower = -0.77
plot(t, s)
axhspan(upper, 1, facecolor='red', alpha=0.5)
axhspan(-1, lower, facecolor='blue', alpha=0.5)
show()
> A second problem for me is probably trivial for more
> experienced users: How to adjust the size of x- &
> y-labels (using subplot)?
> I should mention that I'm stuck with version 0.71 for a
> while ...
xlabel('my label', fontsize=16)
You can also control the default x and y label size, and the tick
label size, in your rc file
http://matplotlib.sourceforge.net/.matplotlibrc
To set the fontsize for the tick labels, you can do something like
locs, labels = xticks()
set(labels, fontsize=16)
Should help!
JDH