@@ -42,7 +42,7 @@ def plotparticles(particles, with_particles=True, show_time=None, field=None, do
4242
4343 if field is None :
4444 spherical = True if particles .fieldset .U .grid .mesh == 'spherical' else False
45- plt , fig , ax , cartopy = create_parcelsfig_axis (spherical , land , projection )
45+ plt , fig , ax , cartopy = create_parcelsfig_axis (spherical , land , projection , cartopy_features = kwargs . pop ( 'cartopy_features' , []) )
4646 if plt is None :
4747 return # creating axes was not possible
4848 ax .set_title ('Particles' + parsetimestr (particles .fieldset .U .grid .time_origin , show_time ))
@@ -75,7 +75,7 @@ def plotparticles(particles, with_particles=True, show_time=None, field=None, do
7575 depth_level = kwargs .pop ('depth_level' , 0 )
7676 plt , fig , ax , cartopy = plotfield (field = field , animation = animation , show_time = show_time , domain = domain ,
7777 projection = projection , land = land , vmin = vmin , vmax = vmax , savefile = None ,
78- titlestr = 'Particles and ' , depth_level = depth_level )
78+ titlestr = 'Particles and ' , depth_level = depth_level , ** kwargs )
7979 if plt is None :
8080 return # creating axes was not possible
8181
@@ -128,7 +128,7 @@ def plotfield(field, show_time=None, domain=None, depth_level=0, projection=None
128128 logger .warning ('Field.show() does not always correctly determine the domain for curvilinear grids. '
129129 'Use plotting with caution and perhaps use domain argument as in the NEMO 3D tutorial' )
130130
131- plt , fig , ax , cartopy = create_parcelsfig_axis (spherical , land , projection = projection )
131+ plt , fig , ax , cartopy = create_parcelsfig_axis (spherical , land , projection = projection , cartopy_features = kwargs . pop ( 'cartopy_features' , []) )
132132 if plt is None :
133133 return None , None , None , None # creating axes was not possible
134134
@@ -258,7 +258,7 @@ def plotfield(field, show_time=None, domain=None, depth_level=0, projection=None
258258 return plt , fig , ax , cartopy
259259
260260
261- def create_parcelsfig_axis (spherical , land = True , projection = None , central_longitude = 0 ):
261+ def create_parcelsfig_axis (spherical , land = True , projection = None , central_longitude = 0 , cartopy_features = [] ):
262262 try :
263263 import matplotlib .pyplot as plt
264264 except :
@@ -288,7 +288,12 @@ def create_parcelsfig_axis(spherical, land=True, projection=None, central_longit
288288 except :
289289 pass
290290
291- if land :
291+ for feature in cartopy_features :
292+ ax .add_feature (feature )
293+
294+ if isinstance (land , str ):
295+ ax .coastlines (land )
296+ elif land :
292297 ax .coastlines ()
293298 else :
294299 cartopy = None
0 commit comments