@@ -2069,18 +2069,26 @@ def format_label(self, label):
2069
2069
nb_obs = len (self ),
2070
2070
)
2071
2071
2072
- def display_color (self , ax , field , intern = False , ** kwargs ):
2072
+ def display_color (self , ax , field , ref = None , intern = False , ** kwargs ):
2073
2073
"""Plot colored contour of eddies
2074
2074
2075
2075
:param matplotlib.axes.Axes ax: matplotlib axe used to draw
2076
2076
:param str,array field: color field
2077
+ :param float,None ref: if defined, all coordinates are wrapped with ref as western boundary
2077
2078
:param bool intern: if True, draw the speed contour
2078
2079
:param dict kwargs: look at :py:meth:`matplotlib.collections.LineCollection`
2079
2080
2080
2081
.. minigallery:: py_eddy_tracker.EddiesObservations.display_color
2081
2082
"""
2082
2083
xname , yname = self .intern (intern )
2083
2084
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
+
2084
2092
c = self .parse_varname (field )
2085
2093
cmap = get_cmap (kwargs .pop ("cmap" , "Spectral_r" ))
2086
2094
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):
2089
2097
[create_vertice (i , j ) for i , j in zip (x , y )], colors = colors , ** kwargs
2090
2098
)
2091
2099
ax .add_collection (lines )
2100
+ lines .cmap = cmap
2101
+ lines .norm = Normalize (vmin = cmin , vmax = cmax )
2092
2102
return lines
2093
2103
2094
2104
def display (self , ax , ref = None , extern_only = False , intern_only = False , ** kwargs ):
0 commit comments