bjornasm
bjornasm

Reputation: 2318

Tickmarks on basemap

To draw meridian lines on a python basemap is a fairly simple job:

fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8])
map = Basemap(epsg=3395,
projection="merc",
resolution = 'h', area_thresh = 0.01,
llcrnrlon=0, llcrnrlat=60,
urcrnrlon=5, urcrnrlat=70, ax=ax)

meridians = np.arange(0,5,1)
map.drawmeridians(meridians,labels=[1,0,0,1])

However, I rather want tickmarks alongside the axis, instead of the dotted lines over my map, as I feel it obstructs the map content.

I tried with the following, to no avail:

ax.xaxis.set_ticks(np.arange(0,5,1))

Upvotes: 1

Views: 3427

Answers (1)

bjornasm
bjornasm

Reputation: 2318

I found a solution. I drew parallels, but assured that they only was drawn at the bottom:

    np.linspace(startlat,endlat,5) # 5 = number of "ticks"
    map.drawmeridians(meridianinterval,labels=[0,0,0,1], dashes=[6,900], color='w')

See the dashes option, which draws 6 pixel long dashes 900 pixels apart (only on the bottom).

Upvotes: 1

Related Questions