2 overlaid plots with grid??

I need to overlay 2 different plots. They will share an x-axis, but will have 2
different y axis with 2 different sets of units. I want one y-axis on left and
one on right.

But to make it harder, I want a grid. That means, there are either 2 different
grids, which is ugly, or one plot has to be scaled vertically so that the same y
grid can be shared between them.

Anyone know how to do this?

···

--
-- Those who don't understand recursion are doomed to repeat it

Well, the first part is easy… it is called twinx(). If you look up axis twinning in the documentation, you will find a lot of examples of this.

As for the grids part… that would be tricky. I would first just see if matplotlib “just does the right thing”. Doubtful, but who knows? Then I would likely go the route of lining up the major ticks on both axes so that the grid lines for one axes match up with the ticks for the other.

Let us know what you find out. Maybe it might be a useful feature to add for twinning.

Cheers!
Ben Root

···

On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndbecker2@…287…> wrote:

I need to overlay 2 different plots. They will share an x-axis, but will have 2

different y axis with 2 different sets of units. I want one y-axis on left and

one on right.

But to make it harder, I want a grid. That means, there are either 2 different

grids, which is ugly, or one plot has to be scaled vertically so that the same y

grid can be shared between them.

Anyone know how to do this?

– Those who don’t understand recursion are doomed to repeat it


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I wrote a program that draws grids manually on mpl plots a while back. If you can’t find a solution can you write back here and I’ll try to get that dusted off?

···

On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndbecker2@…287…> wrote:

I need to overlay 2 different plots. They will share an x-axis, but will have 2

different y axis with 2 different sets of units. I want one y-axis on left and

one on right.

But to make it harder, I want a grid. That means, there are either 2 different

grids, which is ugly, or one plot has to be scaled vertically so that the same y

grid can be shared between them.

Anyone know how to do this?

– Those who don’t understand recursion are doomed to repeat it


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I seem to recall that the MaxNLocator and some carefully chosen axes limits suffices for me in the past.

···

On Tue, Oct 21, 2014 at 11:44 AM, Adam Hughes <hughesadam87@…287…> wrote:

I wrote a program that draws grids manually on mpl plots a while back. If you can’t find a solution can you write back here and I’ll try to get that dusted off?

On Oct 21, 2014 2:39 PM, “Benjamin Root” <ben.root@…878…1304…> wrote:

Well, the first part is easy… it is called twinx(). If you look up axis twinning in the documentation, you will find a lot of examples of this.

As for the grids part… that would be tricky. I would first just see if matplotlib “just does the right thing”. Doubtful, but who knows? Then I would likely go the route of lining up the major ticks on both axes so that the grid lines for one axes match up with the ticks for the other.

Let us know what you find out. Maybe it might be a useful feature to add for twinning.

Cheers!
Ben Root


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndbecker2@…1003…7…> wrote:

I need to overlay 2 different plots. They will share an x-axis, but will have 2

different y axis with 2 different sets of units. I want one y-axis on left and

one on right.

But to make it harder, I want a grid. That means, there are either 2 different

grids, which is ugly, or one plot has to be scaled vertically so that the same y

grid can be shared between them.

Anyone know how to do this?

– Those who don’t understand recursion are doomed to repeat it


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users