Skip to content

Commit 2e24a3e

Browse files
authored
Merge pull request nschloe#311 from nschloe/pandas-mask
Pandas mask
2 parents 33027dc + 5c8caff commit 2e24a3e

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ upload: setup.py
1414
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
1515
rm -f dist/*
1616
python3 setup.py sdist
17-
python3 setup.py bdist_wheel --universal
17+
python3 setup.py bdist_wheel
1818
twine upload dist/*
1919

2020
publish: tag upload

tikzplotlib/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
__email__ = "[email protected]"
33
__copyright__ = "Copyright (c) 2010-2019, {} <{}>".format(__author__, __email__)
44
__license__ = "License :: OSI Approved :: MIT License"
5-
__version__ = "0.8.0"
5+
__version__ = "0.8.1"
66
__status__ = "Development Status :: 5 - Production/Stable"

tikzplotlib/axes.py

+18-22
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,10 @@ def _handle_linear_segmented_color_map(cmap, data):
636636
# For an explanation of what _segmentdata contains, see
637637
# http://matplotlib.org/mpl_examples/pylab_examples/custom_cmap.py
638638
# 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].
643643
segdata = cmap._segmentdata
644644
red = segdata["red"]
645645
green = segdata["green"]
@@ -695,18 +695,17 @@ def _handle_linear_segmented_color_map(cmap, data):
695695
if x >= 1.0:
696696
break
697697

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.
706705
unit = "pt"
707706

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)
710709
# 0-1000 is the internal granularity of PGFplots.
711710
# 16300 was the maximum value for pgfplots<=1.13
712711
X = _scale_to_int(numpy.array(X), 1000)
@@ -776,15 +775,12 @@ def _handle_listed_color_map(cmap, data):
776775
return (colormap_string, is_custom_colormap)
777776

778777

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.
780780
"""
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))
788784
return [int(entry) for entry in X]
789785

790786

tikzplotlib/line2d.py

+4
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ def _table(obj, data):
276276
else:
277277
if isinstance(ydata_mask, numpy.bool_) and not ydata_mask:
278278
ydata_mask = []
279+
elif callable(ydata_mask):
280+
# pandas.Series have the method mask
281+
# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.mask.html
282+
ydata_mask = []
279283

280284
axis_options = []
281285

0 commit comments

Comments
 (0)