@@ -2069,18 +2069,26 @@ def format_label(self, label):
20692069 nb_obs = len (self ),
20702070 )
20712071
2072- def display_color (self , ax , field , intern = False , ** kwargs ):
2072+ def display_color (self , ax , field , ref = None , intern = False , ** kwargs ):
20732073 """Plot colored contour of eddies
20742074
20752075 :param matplotlib.axes.Axes ax: matplotlib axe used to draw
20762076 :param str,array field: color field
2077+ :param float,None ref: if defined, all coordinates are wrapped with ref as western boundary
20772078 :param bool intern: if True, draw the speed contour
20782079 :param dict kwargs: look at :py:meth:`matplotlib.collections.LineCollection`
20792080
20802081 .. minigallery:: py_eddy_tracker.EddiesObservations.display_color
20812082 """
20822083 xname , yname = self .intern (intern )
20832084 x , y = self [xname ], self [yname ]
2085+
2086+ if ref is not None :
2087+ # TODO : maybe buggy with global display
2088+ shape_out = x .shape
2089+ x , y = wrap_longitude (x .reshape (- 1 ), y .reshape (- 1 ), ref )
2090+ x , y = x .reshape (shape_out ), y .reshape (shape_out )
2091+
20842092 c = self .parse_varname (field )
20852093 cmap = get_cmap (kwargs .pop ("cmap" , "Spectral_r" ))
20862094 cmin , cmax = kwargs .pop ("vmin" , c .min ()), kwargs .pop ("vmax" , c .max ())
@@ -2089,6 +2097,8 @@ def display_color(self, ax, field, intern=False, **kwargs):
20892097 [create_vertice (i , j ) for i , j in zip (x , y )], colors = colors , ** kwargs
20902098 )
20912099 ax .add_collection (lines )
2100+ lines .cmap = cmap
2101+ lines .norm = Normalize (vmin = cmin , vmax = cmax )
20922102 return lines
20932103
20942104 def display (self , ax , ref = None , extern_only = False , intern_only = False , ** kwargs ):
0 commit comments