basemap icon indicating copy to clipboard operation
basemap copied to clipboard

colorbar fill whole figure

Open jaodan opened this issue 7 years ago • 13 comments
trafficstars

I use the matplotlib3.0 and basemap 1.2 to plot a map figure. The figure is correct. However, if I add colorbar by "m.colorbar(...)", the colorbar will fill the whole figure. There is no such issue for matplotlib2.2.2 and basemap1.1.

jaodan avatar Oct 01 '18 03:10 jaodan

The same problem that can be found in https://github.com/matplotlib/matplotlib/issues/12355

jiaozhh avatar Oct 01 '18 11:10 jiaozhh

Can you supply a self contained minimal example? Thanks!

jklymak avatar Oct 01 '18 13:10 jklymak

It is extremely doubtful this has anything to do with basemap, but I'll concede that I can't think of how this could happen in any case. All basemap does is performs transformations on coordinates, and provides useful map layers. Matplotlib is still doing all of the plotting.

On Mon, Oct 1, 2018 at 9:42 AM Jody Klymak [email protected] wrote:

Can you supply. Self contained minimal example? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/426#issuecomment-425911843, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-D3-kOqi6-IQ4D6tMHtJdi7cRNCvks5ughvPgaJpZM4XBV1y .

WeatherGod avatar Oct 01 '18 14:10 WeatherGod

Oh, waitaminute... you called enh.colorbar(). Could you try plt.colorbar() or fig.colorbar() instead?

On Mon, Oct 1, 2018 at 10:36 AM Benjamin Root [email protected] wrote:

It is extremely doubtful this has anything to do with basemap, but I'll concede that I can't think of how this could happen in any case. All basemap does is performs transformations on coordinates, and provides useful map layers. Matplotlib is still doing all of the plotting.

On Mon, Oct 1, 2018 at 9:42 AM Jody Klymak [email protected] wrote:

Can you supply. Self contained minimal example? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/426#issuecomment-425911843, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-D3-kOqi6-IQ4D6tMHtJdi7cRNCvks5ughvPgaJpZM4XBV1y .

WeatherGod avatar Oct 01 '18 14:10 WeatherGod

colorbar changed in 3.0 so that aspect ratios mean something a bit different. So its possible there is a bad interaction there. But an example that doesn't require external data sets would help

jklymak avatar Oct 01 '18 14:10 jklymak

This is an axes_toolkit/colorbar/bbox_inches=tight interaction that I can reproduce in Matplotlib.

I'll leave this open at @WeatherGod's discretion; one could imagine basemap not relying on axes_grid for colorbar placement. But thats not to minimize the fact that there is a bug in 3.0 with the above combination....

jklymak avatar Oct 01 '18 16:10 jklymak

Just to be clea, this is only an issue if you do: plt.savefig(..., bbox_inches='tight')? Otherwise I cannot reproduce..

jklymak avatar Oct 01 '18 16:10 jklymak

@jklymak is correct. The issue come from plt.savefig(...,bbox_inchs='tight'). Without this option, everything is fine.

jaodan avatar Oct 01 '18 16:10 jaodan

The issue come from plt.savefig(...,bbox_inchs='tight'). Without this option, everything is fine.

Well that is a pretty useful option. Any idea when we go back to re-using this essential feature for producing publication-quality figures? Currently (with MPL 3.0.2) I am wasting a bunch of time editing prior scripts to reproduce some work that used to work beautifully with this option, but no longer does. Is there a workaround for producing figures that minimize white space?

CommonClimate avatar Dec 10 '18 17:12 CommonClimate

The latest version has fixed this issue, just use the latest version.

yongjias avatar Dec 10 '18 18:12 yongjias

the latest version of matplotlib appears to be 3.0.2, which is what I am using. are you referring to another package?

CommonClimate avatar Dec 10 '18 18:12 CommonClimate

matplotlib v3.0.2 fixed this issue. How did you install it?

On Mon, Dec 10, 2018 at 1:36 PM Julien Emile-Geay [email protected] wrote:

the latest version of matplotlib appears to be 3.0.2, which is what I am using. are you referring to another package?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/426#issuecomment-445923289, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-CzVuFliZaI9nj0LDSYESFquzsYyks5u3qmngaJpZM4XBV1y .

WeatherGod avatar Dec 10 '18 18:12 WeatherGod

Problem was due to running the general Spyder and not the environment-specific Spyder. Sorry for adding to the confusion.

CommonClimate avatar Dec 10 '18 18:12 CommonClimate