Skip to content

Instantly share code, notes, and snippets.

@wyojustin
Created July 16, 2024 23:12
Show Gist options
  • Save wyojustin/c6aa9505797071be982879ae3c0ef19a to your computer and use it in GitHub Desktop.
Save wyojustin/c6aa9505797071be982879ae3c0ef19a to your computer and use it in GitHub Desktop.
### simple cylindrical world map... requires https://github.com/wyojustin/astropy_visibility/blob/main/world.npy
def plot_world_map():
fig, ax = pl.subplots(1, figsize=(12, 6))
ax.set_xticks(np.arange(-180, 181, 60))
ax.set_yticks(np.arange(-90, 91, 30))
antarctica = world[:,1] < -60
ant = world[antarctica]
start = np.argmin(ant[:,0])
stop = np.argmax(ant[:,0])
length = stop - start
ant = np.roll(ant, -start, axis=0)[:length]
ant = np.vstack([[-180, -90], ant, [180, ant[-1,1]], [180, -90]])
rest = world[np.logical_not(antarctica)]
w = np.vstack([rest, [np.nan, np.nan], ant])
ax.set_facecolor('lightblue')
ax.fill(w[:,0], w[:,1], color='grey', alpha=1)
ax.axis('equal')
ax.set_xlim(-180, 180)
ax.set_ylim(-90, 90)
return fig, ax
fig, ax = plot_world_map()
j = ax.set_title("Simple Cylindrical Map")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment