Highlighting portions of a plot

I have a line plot and I'd like to highlight certain segments of it. I think
maybe drawing some segments in a different color might be a good visual clue.
Any suggestion how to approach this?

Neal,

I like to use partially transparent rectangles, such as axhspan and axvspan. Some people are not so great with colors, so I try to minimize line color changes.
If you were going to change line colors, I would do something to the line style to highlight the difference as well. Below is a little test.

Ryan

### Code ###
import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.plot(x, y, 'k-', lw=0.5)

plt.axvspan(0.2, 0.4, color='k', alpha=0.2)

mask = (x > 2.5) & (x < 3.0)

plt.plot(x[mask], y[mask], 'r-', lw=2.5)

plt.show()

ยทยทยท

###########

On 6/27/2013 9:50 AM, Neal Becker wrote:

I have a line plot and I'd like to highlight certain segments of it. I think
maybe drawing some segments in a different color might be a good visual clue.
Any suggestion how to approach this?

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users