Difference between revisions of "File:Parallel Mesh Generation Around the world.png"

From crtc.cs.odu.edu
Jump to: navigation, search
Line 1: Line 1:
fdgdfgdfgfd
+
Script to generate it :
 +
 
 +
 
 +
import cartopy.crs as ccrs
 +
import cartopy.feature as cfeature
 +
import matplotlib.pyplot as plt
 +
fig=plt.figure(figsize=[15,10])
 +
 
 +
ax = plt.axes(projection=ccrs.Robinson())
 +
ax.add_feature(cfeature.LAND,facecolor='lightgrey')
 +
#ax.add_feature(cfeature.OCEAN)
 +
ax.add_feature(cfeature.COASTLINE)
 +
ax.add_feature(cfeature.BORDERS)
 +
 
 +
# make the map global rather than have it zoom in to
 +
# the extents of any plotted data
 +
#ax.set_global()
 +
 
 +
#ax.set_extent([-160,160,-90,90])
 +
 
 +
 
 +
#https://stackoverflow.com/a/25421922
 +
transform = ccrs.PlateCarree()._as_mpl_transform(ax)
 +
for key, value in places.items():
 +
    print(key)
 +
    lon,lat,x,y = value
 +
    # add marker
 +
    plt.plot(lon,lat, marker='D',color='red',markersize=3,transform=ccrs.Geodetic())
 +
    # add text
 +
    plt.annotate(key,xy=(lon,lat), xytext=(x,y),arrowprops=dict(arrowstyle="->",color='red'),xycoords=transform)
 +
 
 +
# Save the plot by calling plt.savefig() BEFORE plt.show()
 +
#plt.savefig('map.svg')
 +
plt.savefig('map.png',dpi=200,bbox_inches='tight')
 +
 
 +
plt.show()

Revision as of 18:28, 6 September 2018

Script to generate it :


import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt fig=plt.figure(figsize=[15,10])

ax = plt.axes(projection=ccrs.Robinson()) ax.add_feature(cfeature.LAND,facecolor='lightgrey')

  1. ax.add_feature(cfeature.OCEAN)

ax.add_feature(cfeature.COASTLINE) ax.add_feature(cfeature.BORDERS)

  1. make the map global rather than have it zoom in to
  2. the extents of any plotted data
  3. ax.set_global()
  1. ax.set_extent([-160,160,-90,90])


  1. https://stackoverflow.com/a/25421922

transform = ccrs.PlateCarree()._as_mpl_transform(ax) for key, value in places.items():

   print(key)
   lon,lat,x,y = value
   # add marker
   plt.plot(lon,lat, marker='D',color='red',markersize=3,transform=ccrs.Geodetic())
   # add text
   plt.annotate(key,xy=(lon,lat), xytext=(x,y),arrowprops=dict(arrowstyle="->",color='red'),xycoords=transform)
  1. Save the plot by calling plt.savefig() BEFORE plt.show()
  2. plt.savefig('map.svg')

plt.savefig('map.png',dpi=200,bbox_inches='tight')

plt.show()

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:41, 10 September 2018Thumbnail for version as of 21:41, 10 September 20182,372 × 1,226 (542 KB)Ctsolakis (talk | contribs)
18:21, 6 September 2018Thumbnail for version as of 18:21, 6 September 20181,794 × 1,557 (319 KB)Ctsolakis (talk | contribs)
18:06, 6 September 2018Thumbnail for version as of 18:06, 6 September 20181,794 × 1,581 (323 KB)Ctsolakis (talk | contribs)
  • You cannot overwrite this file.

There are no pages that link to this file.