Skip to content

Commit 6b34e2a

Browse files
authored
Merge pull request #343 from nschloe/marker
info on scatter markers
2 parents b188ab6 + 21a7de9 commit 6b34e2a

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

test/test_marker.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
14
from helpers import assert_equality
25

36

47
def plot():
5-
from matplotlib import pyplot as plt
6-
import numpy as np
7-
88
fig, ax = plt.subplots()
99
with plt.style.context(("ggplot")):
1010
t = np.linspace(0, 2 * np.pi, 11)
1111
s = np.sin(t)
1212
c = np.cos(t)
13-
ax.plot(t, s, "ko-", mec="r", markevery=20)
14-
ax.plot(t, c, "ks--", mec="r", markevery=20)
13+
s2 = np.sin(2 * t)
14+
ax.plot(t, s, "ko-", mec="r", markevery=2)
15+
ax.plot(t, c, "ks--", mec="r", markevery=3)
16+
ax.scatter(t, s2, s=100, c="black", marker="+")
1517
ax.set_xlim(t[0], t[-1])
1618
ax.set_xlabel("t")
1719
ax.set_ylabel("y")
@@ -22,4 +24,8 @@ def plot():
2224

2325
def test():
2426
assert_equality(plot, __file__[:-3] + "_reference.tex")
25-
return
27+
28+
29+
if __name__ == "__main__":
30+
plot()
31+
plt.show()

test/test_marker_reference.tex

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@
1515
ymin=-1.1, ymax=1.1,
1616
ytick style={color=black}
1717
]
18-
\addplot [semithick, black, mark=*, mark size=3, mark repeat=20, mark options={solid,draw=red}]
18+
\addplot [only marks, draw=black, fill=black, colormap/viridis]
19+
table{%
20+
x y
21+
0 0
22+
0.628318530717959 0.951056516295154
23+
1.25663706143592 0.587785252292473
24+
1.88495559215388 -0.587785252292473
25+
2.51327412287183 -0.951056516295154
26+
3.14159265358979 -2.44929359829471e-16
27+
3.76991118430775 0.951056516295154
28+
4.39822971502571 0.587785252292473
29+
5.02654824574367 -0.587785252292473
30+
5.65486677646163 -0.951056516295154
31+
6.28318530717959 -4.89858719658941e-16
32+
};
33+
\addplot [semithick, black, mark=*, mark size=3, mark repeat=2, mark options={solid,draw=red}]
1934
table {%
2035
0 0
2136
0.628318530717959 0.587785252292473
@@ -29,7 +44,7 @@
2944
5.65486677646163 -0.587785252292473
3045
6.28318530717959 -2.44929359829471e-16
3146
};
32-
\addplot [semithick, black, dashed, mark=square*, mark size=3, mark repeat=20, mark options={solid,draw=red}]
47+
\addplot [semithick, black, dashed, mark=square*, mark size=3, mark repeat=3, mark options={solid,draw=red}]
3348
table {%
3449
0 1
3550
0.628318530717959 0.809016994374947

tikzplotlib/__about__.py

Lines changed: 1 addition & 1 deletion
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.2"
5+
__version__ = "0.8.3"
66
__status__ = "Development Status :: 5 - Production/Stable"

tikzplotlib/axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ def _find_associated_colorbar(obj):
847847

848848

849849
def _try_f2i(x):
850-
"""Convert losslessly float to int if possible.
850+
"""If possible, convert float to int without rounding.
851851
Used for log base: if not used, base for log scale can be "10.0" (and then
852852
printed as such by pgfplots).
853853
"""

tikzplotlib/path.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def draw_pathcollection(data, obj):
152152
except (TypeError, IndexError):
153153
ls = None
154154

155+
# TODO marker info
156+
# <https://github.com/nschloe/tikzplotlib/issues/324>
157+
# <https://github.com/matplotlib/matplotlib/issues/15496>
158+
155159
is_contour = len(dd) == 1
156160
if is_contour:
157161
draw_options = ["draw=none"]

0 commit comments

Comments
 (0)