Discussion:
[Matplotlib-users] subplot layout
Sudheer Joseph
2016-04-25 16:05:25 UTC
Permalink
Hi,
I am looking for a layout as seen in the empty layout attached which is produced using
figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)

However when I use it for getting attached second figure the layout gets modified as seen in attached figure 2.
fig = p.figure(figsize=(20,8))
ax=p.subplot(121)
ax1=p.subplot(222)
ax2=p.subplot(224)

Can any one suggest a way to get figure exactly as the empty layout?

With best regards,
Sudheer

*************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************
Paul Hobson
2016-04-25 16:33:19 UTC
Permalink
Your basemap plot is likely setting the aspect of the axes to "equal", so
it resizes the plot accordingly. Otherwise you'd have a pretty nasty amount
of vertical distortion.

When you save the figure, using bbox_inches='tight' will trim the excess
white space from the margins:
fig.savefig('map_and_bars.png', dpi=600, bbox_inches='tight')

Also, you should try the new viridis color map :)
http://matplotlib.org/users/colormaps.html?highlight=colormaps#miscellaneous
Post by Sudheer Joseph
Hi,
I am looking for a layout as seen in the empty layout attached
which is produced using
figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)
However when I use it for getting attached second figure the layout gets
modified as seen in attached figure 2.
fig = p.figure(figsize=(20,8))
ax=p.subplot(121)
ax1=p.subplot(222)
ax2=p.subplot(224)
Can any one suggest a way to get figure exactly as the empty layout?
With best regards,
Sudheer
*************************************************************** Sudheer
Joseph Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla
P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
http://oppamthadathil.tripod.com
***************************************************************
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jody Klymak
2016-04-25 16:27:15 UTC
Permalink
Yes, the left hand axis is shrinking in the vertical because it is applying the aspect ratio appropriate for 15 N and the N/S extent of your data. Either make the N/S extent of the map larger; make the left hand column wider; or make the figure shorter.

Cheers, Jody
Post by Sudheer Joseph
Hi,
I am looking for a layout as seen in the empty layout attached which is produced using
figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)
However when I use it for getting attached second figure the layout gets modified as seen in attached figure 2.
fig = p.figure(figsize=(20,8))
ax=p.subplot(121)
ax1=p.subplot(222)
ax2=p.subplot(224)
Can any one suggest a way to get figure exactly as the empty layout?
With best regards,
Sudheer
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Jody Klymak
http://web.uvic.ca/~jklymak/
Sudheer Joseph
2016-04-25 23:47:24 UTC
Permalink
Thank you Paul,
Thanks for the tips related to margins and also about colormaps. Is there a way to stop the automatic aspect ratio setting ( though it it distors map in present case ) if I wanted to use that for other plots?

With best regards,
Sudheer


*************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************

--------------------------------------------
On Mon, 25/4/16, Paul Hobson <***@gmail.com> wrote:

Subject: Re: [Matplotlib-users] subplot layout
To: "Sudheer Joseph" <***@yahoo.com>
Cc: "Matplotlib Users" <matplotlib-***@lists.sourceforge.net>
Date: Monday, 25 April, 2016, 4:33 PM

Your
basemap plot is likely setting the aspect of the axes to
"equal", so it resizes the plot accordingly.
Otherwise you'd have a pretty nasty amount of vertical
distortion.
When you save
the figure, using bbox_inches='tight' will trim the
excess white space from the
margins:fig.savefig('map_and_bars.png',
dpi=600, bbox_inches='tight')
Also, you should try the new viridis
color map :) http://matplotlib.org/users/colormaps.html?highlight=colormaps#miscellaneous



On Mon, Apr 25, 2016 at
9:05 AM, Sudheer Joseph <***@yahoo.com>
wrote:
Hi,

           I am looking for a layout as seen in the
empty layout attached which is produced using

figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)



However when I use it for getting attached second figure the
layout gets modified as seen in attached figure 2.

fig = p.figure(figsize=(20,8))

ax=p.subplot(121)

ax1=p.subplot(222)

ax2=p.subplot(224)



Can any one suggest a way to get figure exactly as the empty
layout?



With best regards,

Sudheer



***************************************************************
Sudheer Joseph         Indian National Centre for Ocean
Information Services Ministry of Earth Sciences, Govt. of
India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi
Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************
------------------------------------------------------------------------------

Find and fix application performance issues faster with
Applications Manager

Applications Manager provides deep performance insights into
multiple tiers of

your business applications. It resolves application problems
quickly and

reduces your MTTR. Get your free trial!

https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________

Matplotlib-users mailing list

Matplotlib-***@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Sudheer Joseph
2016-04-26 01:24:51 UTC
Permalink
Hi Paul,

I tried to get the new colormap suggestion from you but could not get the colormap package. Where can I get it? google search did not took me to the package/
Is it a development package?
May I know how to use viridis color map with an example plot?


Below is an example code from the link you send

'''
For each colormap, plot the lightness parameter L* from CIELAB colorspace
along the y axis vs index through the colormap. Colormaps are examined in
categories as in the original matplotlib gallery of colormaps.
'''

from colormaps import cmaps
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib as mpl
from colorspacious import cspace_converter



*************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************

--------------------------------------------
On Mon, 25/4/16, Paul Hobson <***@gmail.com> wrote:

Subject: Re: [Matplotlib-users] subplot layout
To: "Sudheer Joseph" <***@yahoo.com>
Cc: "Matplotlib Users" <matplotlib-***@lists.sourceforge.net>
Date: Monday, 25 April, 2016, 4:33 PM

Your
basemap plot is likely setting the aspect of the axes to
"equal", so it resizes the plot accordingly.
Otherwise you'd have a pretty nasty amount of vertical
distortion.
When you save
the figure, using bbox_inches='tight' will trim the
excess white space from the
margins:fig.savefig('map_and_bars.png',
dpi=600, bbox_inches='tight')
Also, you should try the new viridis
color map :) http://matplotlib.org/users/colormaps.html?highlight=colormaps#miscellaneous



On Mon, Apr 25, 2016 at
9:05 AM, Sudheer Joseph <***@yahoo.com>
wrote:
Hi,

           I am looking for a layout as seen in the
empty layout attached which is produced using

figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)



However when I use it for getting attached second figure the
layout gets modified as seen in attached figure 2.

fig = p.figure(figsize=(20,8))

ax=p.subplot(121)

ax1=p.subplot(222)

ax2=p.subplot(224)



Can any one suggest a way to get figure exactly as the empty
layout?



With best regards,

Sudheer



***************************************************************
Sudheer Joseph         Indian National Centre for Ocean
Information Services Ministry of Earth Sciences, Govt. of
India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi
Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************
------------------------------------------------------------------------------

Find and fix application performance issues faster with
Applications Manager

Applications Manager provides deep performance insights into
multiple tiers of

your business applications. It resolves application problems
quickly and

reduces your MTTR. Get your free trial!

https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________

Matplotlib-users mailing list

Matplotlib-***@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Hobson
2016-04-26 06:53:48 UTC
Permalink
Viridis is in the `cm` submodule.

from matplotlib import cm
cmap = cm.viridis
Post by Sudheer Joseph
Hi Paul,
I tried to get the new colormap suggestion from you but could not get the
colormap package. Where can I get it? google search did not took me to the
package/
Is it a development package?
May I know how to use viridis color map with an example plot?
Below is an example code from the link you send
'''
For each colormap, plot the lightness parameter L* from CIELAB colorspace
along the y axis vs index through the colormap. Colormaps are examined in
categories as in the original matplotlib gallery of colormaps.
'''
from colormaps import cmaps
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib as mpl
from colorspacious import cspace_converter
*************************************************************** Sudheer
Joseph Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla
+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
http://oppamthadathil.tripod.com
***************************************************************
--------------------------------------------
Subject: Re: [Matplotlib-users] subplot layout
Date: Monday, 25 April, 2016, 4:33 PM
Your
basemap plot is likely setting the aspect of the axes to
"equal", so it resizes the plot accordingly.
Otherwise you'd have a pretty nasty amount of vertical
distortion.
When you save
the figure, using bbox_inches='tight' will trim the
excess white space from the
margins:fig.savefig('map_and_bars.png',
dpi=600, bbox_inches='tight')
Also, you should try the new viridis
color map :)
http://matplotlib.org/users/colormaps.html?highlight=colormaps#miscellaneous
On Mon, Apr 25, 2016 at
Hi,
I am looking for a layout as seen in the
empty layout attached which is produced using
figsize(20,8),subplot(1,2,1);subplot(222);subplot(224)
However when I use it for getting attached second figure the
layout gets modified as seen in attached figure 2.
fig = p.figure(figsize=(20,8))
ax=p.subplot(121)
ax1=p.subplot(222)
ax2=p.subplot(224)
Can any one suggest a way to get figure exactly as the empty
layout?
With best regards,
Sudheer
***************************************************************
Sudheer Joseph Indian National Centre for Ocean
Information Services Ministry of Earth Sciences, Govt. of
India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi
Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
Web- http://oppamthadathil.tripod.com
***************************************************************
------------------------------------------------------------------------------
Find and fix application performance issues faster with
Applications Manager
Applications Manager provides deep performance insights into
multiple tiers of
your business applications. It resolves application problems
quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Continue reading on narkive:
Loading...