@@ -636,10 +636,10 @@ def _handle_linear_segmented_color_map(cmap, data):
636
636
# For an explanation of what _segmentdata contains, see
637
637
# http://matplotlib.org/mpl_examples/pylab_examples/custom_cmap.py
638
638
# A key sentence:
639
- # If there are discontinuities, then it is a little more complicated.
640
- # Label the 3 elements in each row in the cdict entry for a given color as
641
- # (x, y0, y1). Then for values of x between x[i] and x[i+1] the color
642
- # value is interpolated between y1[i] and y0[i+1].
639
+ # If there are discontinuities, then it is a little more complicated. Label the 3
640
+ # elements in each row in the cdict entry for a given color as (x, y0, y1). Then
641
+ # for values of x between x[i] and x[i+1] the color value is interpolated between
642
+ # y1[i] and y0[i+1].
643
643
segdata = cmap ._segmentdata
644
644
red = segdata ["red" ]
645
645
green = segdata ["green" ]
@@ -695,18 +695,17 @@ def _handle_linear_segmented_color_map(cmap, data):
695
695
if x >= 1.0 :
696
696
break
697
697
698
- # The PGFPlots color map has an actual physical scale, like (0cm,10cm), and
699
- # the points where the colors change is also given in those units. As of
700
- # now (2010-05-06) it is crucial for PGFPlots that the difference between
701
- # two successive points is an integer multiple of a given unity (parameter
702
- # to the colormap; e.g., 1cm). At the same time, TeX suffers from
703
- # significant round-off errors, so make sure that this unit is not too
704
- # small such that the round- off errors don't play much of a role. A unit
705
- # of 1pt, e.g., does most often not work.
698
+ # The PGFPlots color map has an actual physical scale, like (0cm,10cm), and the
699
+ # points where the colors change is also given in those units. As of now
700
+ # (2010-05-06) it is crucial for PGFPlots that the difference between two successive
701
+ # points is an integer multiple of a given unity (parameter to the colormap; e.g.,
702
+ # 1cm). At the same time, TeX suffers from significant round-off errors, so make
703
+ # sure that this unit is not too small such that the round- off errors don't play
704
+ # much of a role. A unit of 1pt, e.g., does most often not work.
706
705
unit = "pt"
707
706
708
- # Scale to integer (too high integers will firstly be slow and secondly may
709
- # produce dimension errors or memory errors in latex)
707
+ # Scale to integer (too high integers will firstly be slow and secondly may produce
708
+ # dimension errors or memory errors in latex)
710
709
# 0-1000 is the internal granularity of PGFplots.
711
710
# 16300 was the maximum value for pgfplots<=1.13
712
711
X = _scale_to_int (numpy .array (X ), 1000 )
@@ -776,15 +775,12 @@ def _handle_listed_color_map(cmap, data):
776
775
return (colormap_string , is_custom_colormap )
777
776
778
777
779
- def _scale_to_int (X , max_val = None ):
778
+ def _scale_to_int (X , max_val ):
779
+ """Scales the array X such that it contains only integers.
780
780
"""
781
- Scales the array X such that it contains only integers.
782
- """
783
-
784
- if max_val is None :
785
- X = X / _gcd_array (X )
786
- else :
787
- X = X / max (1 / max_val , _gcd_array (X ))
781
+ # if max_val is None:
782
+ # X = X / _gcd_array(X)
783
+ X = X / max (1 / max_val , _gcd_array (X ))
788
784
return [int (entry ) for entry in X ]
789
785
790
786
0 commit comments