Skip to content

Commit

Permalink
Merge pull request #490 from dhoekstra2000/fix-scatter-colors
Browse files Browse the repository at this point in the history
Change to only add  option if there is cmap
  • Loading branch information
nschloe committed Jun 21, 2021
2 parents 7f4d2d4 + 37a72e2 commit e30740a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/tikzplotlib/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ def draw_pathcollection(data, obj):
fmt = "{:" + data["float format"] + "}"
dd_strings = np.array([[fmt.format(val) for val in row] for row in dd])

draw_options = ["scatter", "only marks"]
draw_options = ["only marks"]
table_options = []

is_filled = False

if obj.get_array() is not None:
draw_options.append("scatter")
dd_strings = np.column_stack([dd_strings, obj.get_array()])
labels.append("colordata")
draw_options.append("scatter src=explicit")
Expand All @@ -139,6 +138,7 @@ def draw_pathcollection(data, obj):
marker0 = None
if obj.get_cmap():
mycolormap, is_custom_cmap = _mpl_cmap2pgf_cmap(obj.get_cmap(), data)
draw_options.append("scatter")
draw_options.append(
"colormap" + ("=" if is_custom_cmap else "/") + mycolormap
)
Expand Down Expand Up @@ -276,6 +276,7 @@ def draw_pathcollection(data, obj):
[
"visualization depends on="
+ "{\\thisrow{sizedata} \\as\\perpointmarksize}",
"scatter",
"scatter/@pre marker code/.append style="
+ "{/tikz/mark size=\\perpointmarksize}",
# "scatter/@post marker code/.style={}"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_legend_line_scatter_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
ymin=-0.2, ymax=4.2,
ytick style={color=black}
]
\addplot [draw=color0, fill=color0, mark=*, only marks, scatter]
\addplot [draw=color0, fill=color0, mark=*, only marks]
table{%
x y
0 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_marker_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ymin=-1.1, ymax=1.1,
ytick style={color=black}
]
\addplot [draw=black, fill=black, mark=+, only marks, scatter]
\addplot [draw=black, fill=black, mark=+, only marks]
table{%
x y
0 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scatter_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ymin=0.17184841, ymax=112.81716,
ytick style={color=black}
]
\addplot [draw=color0, fill=color0, mark=*, only marks, scatter]
\addplot [draw=color0, fill=color0, mark=*, only marks]
table{%
x y
0 10.447038
Expand Down

0 comments on commit e30740a

Please sign in to comment.