Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bbox_inches='tight' clips figure.suptitle #688

Closed
Assignees
pelson
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug
@fperez

Description

@fperez

In ipython for the qtconsole and notebook, we send inline figures using

fig.canvas.print_figure(bytes_io, format=fmt, bbox_inches='tight')

as seenhere.

However, this produces truncated figure titles. Consider this code:

f,ax=plt.subplots()ax.plot(rand(100))ax.set_title('Axis title')f.suptitle('Figure title');

which produces this in the notebook:

A slightly more complicated example, using basemap, not only truncates the title but also all the x and y labels. We show it here for reference, but as@jswhit (basemap author) pointed out over email, basemap labels are located at arbitrary positions and so it's harder for matplotlib to take them into consideration.

frommpl_toolkits.basemapimportBasemaplon0,lat0,lon1,lat1= (84.38,26.22,88.9,29.8)resolution='i'parallels=np.linspace(lat0,lat1,5)meridians=np.linspace(lon0,lon1,5)f,ax=plt.subplots()m=Basemap(lon0,lat0,lon1,lat1,resolution=resolution,ax=ax)m.drawcountries(color=(1,1,0))# country boundaries in pure yellowm.drawrivers(color=(0,1,1))# rivers in cyanm.bluemarble()# NASA bluemarble imagem.drawmeridians(meridians,labels=[0,0,0,1],fmt='%.2f')m.drawparallels(parallels,labels=[1,0,0,0],fmt='%.2f')f.suptitle('The Himalayas');

While we noticed this in the notebook, the problem will be present for any figure saving operation that supportsbbox_inches='tight'.

As discussed in themailing list thread about this problem, mpl should probably use the position of 'official' artists such figure suptitles in the computation of the bounding box.

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp