@@ -335,11 +335,10 @@ def _colorbar(self, colorbar, data):
335
335
colorbar_ticks_minor = colorbar .ax .get_xticks ("minor" )
336
336
axis_limits = colorbar .ax .get_xlim ()
337
337
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.
343
342
colorbar_ticks = (colorbar_ticks - axis_limits [0 ]) / (
344
343
axis_limits [1 ] - axis_limits [0 ]
345
344
) * (limits [1 ] - limits [0 ]) + limits [0 ]
@@ -368,11 +367,10 @@ def _colorbar(self, colorbar, data):
368
367
colorbar_ticks_minor = colorbar .ax .get_yticks ("minor" )
369
368
axis_limits = colorbar .ax .get_ylim ()
370
369
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.
376
374
colorbar_ticks = (colorbar_ticks - axis_limits [0 ]) / (
377
375
axis_limits [1 ] - axis_limits [0 ]
378
376
) * (limits [1 ] - limits [0 ]) + limits [0 ]
@@ -493,8 +491,8 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
493
491
)
494
492
)
495
493
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
498
496
if tick_label_text_width :
499
497
if tick_labels_horizontal_alignment_same_value :
500
498
values .append (
@@ -565,6 +563,8 @@ def _get_ticks(data, xy, ticks, ticklabels):
565
563
pgfplots_ticks .append (tick )
566
564
# store the label anyway
567
565
label = ticklabel .get_text ()
566
+ if "," in label :
567
+ label = "{" + label + "}"
568
568
if ticklabel .get_visible ():
569
569
label = _common_texification (label )
570
570
pgfplots_ticklabels .append (label )
@@ -813,9 +813,9 @@ def _gcd(a, b):
813
813
This algoritm also works for real numbers:
814
814
Find the greatest number h such that a and b are integer multiples of h.
815
815
"""
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
819
819
# [1.0, 2.0000000001, 3.0, 4.0].
820
820
while a > 1.0e-5 :
821
821
a , b = b % a , a
@@ -829,9 +829,9 @@ def _linear_interpolation(x, X, Y):
829
829
830
830
831
831
def _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.
835
835
"""
836
836
for child in obj .get_children ():
837
837
try :
@@ -840,8 +840,7 @@ def _find_associated_colorbar(obj):
840
840
continue
841
841
if cbar is not None : # really necessary?
842
842
# 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)
845
844
return cbar
846
845
return None
847
846
0 commit comments