Cartopy subplot layout issues with ticks & axes box line

463 views
Skip to first unread message

Daniel Odermatt

unread,
Sep 8, 2014, 10:30:09 AM9/8/14
to scitoo...@googlegroups.com
Hi all

I'm using cartopy to plot several lakes of very different sizes in different subplot arrangements (1x2, 3x4 etc.), which makes it quite difficult to find consistent layout parameters. An example is attached below. One issue is that longitude tick labels are overlapping for small lakes. Is there a way to rotate them? I'm creating the grid and ticks as follows:

gridlines = map.gridlines(crs=crs, draw_labels=True, linewidth=linewidth, color='black', alpha=1.0, linestyle=':', zorder=13)

The other issue is that by downscaling the Geoaxes in the subplot arrangement, the bounding box' line thickness gets very wide. Is there a way to set it explicitely? Here's the command I'm using to add each Geoaxes subplot:

map = fig.add_subplot(nrows, ncols, 1 + nth_col + (ncols * nth_row), projection=ccrs.Mercator())


Best regards,
Daniel


Heiko Balzter

unread,
Apr 18, 2018, 5:13:33 PM4/18/18
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hi Daniel,

To rotate the font orientation of the axis tick labels, you can use:

plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right')

The bounding box properties of a geoAxes object can be changed by accessing the outline_patch of the geoAxes.
For example, this makes the box invisible:

ax.outline_patch.set_visible(False)

The fill colour (facecolor) in Cartopy is defined as part of the background_patch, for example:

ax.background_patch.set_visible(False)

Hope this helps.

Heiko
Reply all
Reply to author
Forward
0 new messages