@@ -335,11 +335,10 @@ def _colorbar(self, colorbar, data):
335335 colorbar_ticks_minor = colorbar .ax .get_xticks ("minor" )
336336 axis_limits = colorbar .ax .get_xlim ()
337337
338- # In matplotlib, the colorbar color limits are determined by
339- # get_clim(), and the tick positions are as usual with respect
340- # to {x,y}lim. In PGFPlots, however, they are mixed together.
341- # Hence, scale the tick positions just like {x,y}lim are scaled
342- # to clim.
338+ # In matplotlib, the colorbar color limits are determined by get_clim(), and
339+ # the tick positions are as usual with respect to {x,y}lim. In PGFPlots,
340+ # however, they are mixed together. Hence, scale the tick positions just
341+ # like {x,y}lim are scaled to clim.
343342 colorbar_ticks = (colorbar_ticks - axis_limits [0 ]) / (
344343 axis_limits [1 ] - axis_limits [0 ]
345344 ) * (limits [1 ] - limits [0 ]) + limits [0 ]
@@ -368,11 +367,10 @@ def _colorbar(self, colorbar, data):
368367 colorbar_ticks_minor = colorbar .ax .get_yticks ("minor" )
369368 axis_limits = colorbar .ax .get_ylim ()
370369
371- # In matplotlib, the colorbar color limits are determined by
372- # get_clim(), and the tick positions are as usual with respect
373- # to {x,y}lim. In PGFPlots, however, they are mixed together.
374- # Hence, scale the tick positions just like {x,y}lim are scaled
375- # to clim.
370+ # In matplotlib, the colorbar color limits are determined by get_clim(), and
371+ # the tick positions are as usual with respect to {x,y}lim. In PGFPlots,
372+ # however, they are mixed together. Hence, scale the tick positions just
373+ # like {x,y}lim are scaled to clim.
376374 colorbar_ticks = (colorbar_ticks - axis_limits [0 ]) / (
377375 axis_limits [1 ] - axis_limits [0 ]
378376 ) * (limits [1 ] - limits [0 ]) + limits [0 ]
@@ -493,8 +491,8 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
493491 )
494492 )
495493
496- # Ignore horizontal alignment if no '{x,y} tick label text width' has
497- # been passed in the 'extra' parameter
494+ # Ignore horizontal alignment if no '{x,y} tick label text width' has been
495+ # passed in the 'extra' parameter
498496 if tick_label_text_width :
499497 if tick_labels_horizontal_alignment_same_value :
500498 values .append (
@@ -565,6 +563,8 @@ def _get_ticks(data, xy, ticks, ticklabels):
565563 pgfplots_ticks .append (tick )
566564 # store the label anyway
567565 label = ticklabel .get_text ()
566+ if "," in label :
567+ label = "{" + label + "}"
568568 if ticklabel .get_visible ():
569569 label = _common_texification (label )
570570 pgfplots_ticklabels .append (label )
@@ -813,9 +813,9 @@ def _gcd(a, b):
813813 This algoritm also works for real numbers:
814814 Find the greatest number h such that a and b are integer multiples of h.
815815 """
816- # Keep the tolerance somewhat significantly above machine precision as
817- # otherwise round-off errors will be accounted for, returning 1.0e-10
818- # instead of 1.0 for the values
816+ # Keep the tolerance somewhat significantly above machine precision as otherwise
817+ # round-off errors will be accounted for, returning 1.0e-10 instead of 1.0 for the
818+ # values
819819 # [1.0, 2.0000000001, 3.0, 4.0].
820820 while a > 1.0e-5 :
821821 a , b = b % a , a
@@ -829,9 +829,9 @@ def _linear_interpolation(x, X, Y):
829829
830830
831831def _find_associated_colorbar (obj ):
832- """A rather poor way of telling whether an axis has a colorbar associated:
833- Check the next axis environment, and see if it is de facto a color bar;
834- if yes, return the color bar object.
832+ """A rather poor way of telling whether an axis has a colorbar associated: Check the
833+ next axis environment, and see if it is de facto a color bar; if yes, return the
834+ color bar object.
835835 """
836836 for child in obj .get_children ():
837837 try :
@@ -840,8 +840,7 @@ def _find_associated_colorbar(obj):
840840 continue
841841 if cbar is not None : # really necessary?
842842 # if fetch was successful, cbar contains
843- # (reference to colorbar,
844- # reference to axis containing colorbar)
843+ # (reference to colorbar, reference to axis containing colorbar)
845844 return cbar
846845 return None
847846
0 commit comments