Skip to content

Commit 036bf7d

Browse files
committed
remove redudant semicolons
1 parent 7f4d2d4 commit 036bf7d

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/tikzplotlib/_patch.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ def _patch_legend(obj, draw_options, legend_type):
5555
if _is_in_legend(obj):
5656
# Unfortunately, patch legend entries need \addlegendimage in Pgfplots.
5757
do = ", ".join([legend_type] + draw_options) if draw_options else ""
58-
legend += "\\addlegendimage{{{}}}\n\\addlegendentry{{{}}}\n\n".format(
59-
do, obj.get_label()
60-
)
58+
label = obj.get_label()
59+
legend += f"\\addlegendimage{{{do}}}\n\\addlegendentry{{{label}}}\n\n"
6160

6261
return legend
6362

@@ -145,9 +144,8 @@ def _draw_rectangle(data, obj, draw_options):
145144

146145
if label != "_nolegend_" and label not in data["rectangle_legends"]:
147146
data["rectangle_legends"].add(label)
148-
cont += "\\addlegendimage{{ybar,ybar legend,{}}};\n".format(
149-
",".join(draw_options)
150-
)
147+
draw_opts = ",".join(draw_options)
148+
cont += f"\\addlegendimage{{ybar,ybar legend,{draw_opts}}}\n"
151149
cont += f"\\addlegendentry{{{label}}}\n\n"
152150
return data, cont
153151

tests/test_barchart_legend_reference.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
ytick style={color=black}
1414
]
1515
\draw[draw=none,fill=blue] (axis cs:-0.375,0) rectangle (axis cs:-0.125,1);
16-
\addlegendimage{ybar,ybar legend,draw=none,fill=blue};
16+
\addlegendimage{ybar,ybar legend,draw=none,fill=blue}
1717
\addlegendentry{Data 1}
1818

1919
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
2020
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
2121
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
22-
\addlegendimage{ybar,ybar legend,draw=none,fill=green!50!black};
22+
\addlegendimage{ybar,ybar legend,draw=none,fill=green!50!black}
2323
\addlegendentry{Data 2}
2424

2525
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
2626
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
2727
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
28-
\addlegendimage{ybar,ybar legend,draw=none,fill=red};
28+
\addlegendimage{ybar,ybar legend,draw=none,fill=red}
2929
\addlegendentry{Data 3}
3030

3131
\draw[draw=none,fill=red] (axis cs:1.125,0) rectangle (axis cs:1.375,3);

tests/test_histogram_reference.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ytick style={color=black}
1717
]
1818
\draw[draw=none,fill=color0] (axis cs:3.53789,0) rectangle (axis cs:4.8984168,7);
19-
\addlegendimage{ybar,ybar legend,draw=none,fill=color0};
19+
\addlegendimage{ybar,ybar legend,draw=none,fill=color0}
2020
\addlegendentry{men}
2121

2222
\draw[draw=none,fill=color0] (axis cs:4.8984168,0) rectangle (axis cs:6.2589437,27);
@@ -29,7 +29,7 @@
2929
\draw[draw=none,fill=color0] (axis cs:14.422105,0) rectangle (axis cs:15.782632,7);
3030
\draw[draw=none,fill=color0] (axis cs:15.782632,0) rectangle (axis cs:17.143158,2);
3131
\draw[draw=none,fill=color1,fill opacity=0.5] (axis cs:0.59586541,0) rectangle (axis cs:2.5914912,2);
32-
\addlegendimage{ybar,ybar legend,draw=none,fill=color1,fill opacity=0.5};
32+
\addlegendimage{ybar,ybar legend,draw=none,fill=color1,fill opacity=0.5}
3333
\addlegendentry{women}
3434

3535
\draw[draw=none,fill=color1,fill opacity=0.5] (axis cs:2.5914912,0) rectangle (axis cs:4.587117,6);

0 commit comments

Comments
 (0)