two simple questions

Hi,
  Please excuse the simple questions.

i) Is it possible to draw step functions in matplotlib, i.e instead of
joining points with lines, using steps instead. In R
(http://cran.r-project.org) this would be done with something like,
type='s'. I can think of a simple hack to do it, but thought it might
exist in pylab, but couldn't find an example.

ii) Masking in imshow: I want to plot a 2d image, but only show a
particular region, setting the rest black (or some other color). Is
there a way to get to the RGB data that is output from the colormap to
explicitly set some regions black? Or maybe change the alpha level in
these regions?

Thanks,

Jonathan Taylor

···

--
Jonathan Taylor Tel: 650.723.9230
Dept. of Statistics Fax: 650.725.8977
Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo
390 Serra Mall
Stanford, CA 94305

Jonathan Taylor wrote:

Hi,
Please excuse the simple questions.

i) Is it possible to draw step functions in matplotlib, i.e instead of
joining points with lines, using steps instead. In R
(http://cran.r-project.org) this would be done with something like,
type='s'. I can think of a simple hack to do it, but thought it might
exist in pylab, but couldn't find an example.

try giving plot() an options linestyle='steps'. This was modeled on how gnuplot does it.

ii) Masking in imshow: I want to plot a 2d image, but only show a
particular region, setting the rest black (or some other color). Is
there a way to get to the RGB data that is output from the colormap to
explicitly set some regions black? Or maybe change the alpha level in
these regions?

i do something similar using the 'fill' command. Does the job.

···

--
Peter Groszkowski Gemini Observatory
Tel: +1 808 9742509 670 N. A'ohoku Place
Fax: +1 808 9359235 Hilo, Hawai'i 96720, USA