Skip to content

"Minor" longitude and latitude gridlines #27

Closed
@bradyrx

Description

@bradyrx

Is there any straight forward way to stride through what tick labels are shown in cartopy? Or could this be added as a feature?

This would be the equivalent of having xticks=[0,5,10,15,20] + xticklabels=['0', '', '10', '', '20'] for instance. The idea here is especially in longitude when labels get packed and overlapped at a reasonable font size for folks to see.

import numpy as np
import proplot as plot

plot.rc['geogrid.linestyle'] = ':'
plot.rc['geogrid.linewidth'] = 2
plot.rc['geogrid.color'] = '#d3d3d3'

data = np.random.rand(90, 180)
lon = np.linspace(-179.5, 179.5, 180)
lat = np.linspace(-89.5, 89.5, 90)

f, ax = plot.subplots(width='12cm', aspect=4, proj='cyl', tight=True,)

p = ax.pcolormesh(lon, lat, data, )

ax.format(latlim=(20,50), lonlim=(-135, -105), land=True,
          latlines=plot.arange(20,50,5), lonlines=plot.arange(-135,-105, 5),
          labels=True)

ax.colorbar(p, loc='r')

Screen Shot 2019-08-28 at 2 06 45 PM

This case doesn't have any issues, but imagine if you wanted the label size to be 14, 16, or 18 point font for a poster. All the lon labels overlap. Any way to show just 130W, 120W, 110W but maintain the grid structure? I figure there's a means to do it with the formatter/ticker, but I can't figure it out..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions