date plot with two y axes...and some other things

Goals: date plot with two y axes (plotting completely different things)
            point picking and point labeling
            As many lines as user wants, all colored differently.

Having some problems with this. (matplotlib 0.98.5)

1) There is a known bug with twinx() and plot_date:

http://sourceforge.net/tracker/index.php?func=detail&aid=3046812&group_id=80706&atid=560720

But I can get it to work if I change ONE OF the plot_date() calls (the
one for the values plotted to the right-hand y axis) to just plot().

Is that going to introduce problems? Is there a better workaround?
(The ones on that page don't work for me).

2) How can I get the lines belonging to different axes to cycle
through colors such that the same color is not used for any lines
shown in the plot? (that is, I don't want to hard code a color to any
line, I want it to auto-cycle).

3) My point picking is not working with the two axes. In my routine,
I label the picked point and to do that I have to make reference to
its axis and call plot_date(). How can I know which axis the picked
point came from, so that I can label it appropriately?

Sorry this is a little stirred together, but hoping I can get some
hints to allow me to work it into shape.

Thanks,
Che

ax1 = subplot(121)
ax2 = subplot(122)

import itertools
clist = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
color_cycle = itertools.cycle(clist)

ax1.set_color_cycle(color_cycle)
ax2.set_color_cycle(color_cycle)

ax1.plot([1,2,3])
ax2.plot([1,3,2])

-JJ

···

On Fri, Nov 19, 2010 at 2:59 AM, C M <cmpython@...287...> wrote:

2) How can I get the lines belonging to different axes to cycle
through colors such that the same color is not used for any lines
shown in the plot? (that is, I don't want to hard code a color to any
line, I want it to auto-cycle).

Goals: date plot with two y axes (plotting completely different things)
point picking and point labeling
As many lines as user wants, all colored differently.

Having some problems with this. (matplotlib 0.98.5)

1) There is a known bug with twinx() and plot_date:

http://sourceforge.net/tracker/index.php?func=detail&aid=3046812&group_id=80706&atid=560720

But I can get it to work if I change ONE OF the plot_date() calls (the
one for the values plotted to the right-hand y axis) to just plot().

Is that going to introduce problems? Is there a better workaround?
(The ones on that page don't work for me).

So far, so good with this. But for others working on it, I have found
that the *order* of plotting matters.

That is, I have two axes and I have to use plot() for one axis and
plot_date() for the other, but it must be plot() that is used first or
else I will get the error: ValueError: ordinal must be >= 1.

I'm managing my lines and grouping them by axes, and then making sure
I plot all the lines on the axis that uses plot() first. Seems to
work fine after that.

3) My point picking is not working with the two axes. In my routine,
I label the picked point and to do that I have to make reference to
its axis and call plot_date(). How can I know which axis the picked
point came from, so that I can label it appropriately?

I should have just thought about that more. Of course, there is the
method myline.get_axes() for that.

Che

···

On Thu, Nov 18, 2010 at 12:59 PM, C M <cmpython@...287...> wrote: