Skip to content

Commit ec04d7c

Browse files
committed
pyupgrade
1 parent 7763c2b commit ec04d7c

File tree

9 files changed

+16
-17
lines changed

9 files changed

+16
-17
lines changed

test/test_basic_sin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def plot():
88
fig = plt.figure()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.arange(0.0, 2.0, 0.1)
1111
s = np.sin(2 * np.pi * t)
1212
s2 = np.cos(2 * np.pi * t)

test/test_errorband.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def plot():
88
fig, ax = plt.subplots()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.linspace(0, 2 * np.pi, 11)
1111
s = np.sin(t)
1212
ax.plot(t, s, "k-")

test/test_externalize_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def plot():
66
import numpy as np
77

88
fig = plt.figure()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.arange(0.0, 2.0, 0.1)
1111
s = np.sin(2 * np.pi * t)
1212
s2 = np.cos(2 * np.pi * t)

test/test_line_color_marker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def plot():
66
import numpy as np
77

88
fig = plt.figure()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.arange(0.0, 2.0, 0.1)
1111
s = np.sin(2 * np.pi * t)
1212
s2 = np.cos(2 * np.pi * t)

test/test_marker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def plot():
88
fig, ax = plt.subplots()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.linspace(0, 2 * np.pi, 11)
1111
s = np.sin(t)
1212
c = np.cos(t)

test/test_scatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def plot():
66
import numpy as np
77

88
fig = plt.figure()
9-
with plt.style.context(("fivethirtyeight")):
9+
with plt.style.context("fivethirtyeight"):
1010
np.random.seed(123)
1111
plt.scatter(
1212
np.linspace(0, 100, 101),

tikzplotlib/_axes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ def __init__(self, data, obj): # noqa: C901
4444
data["current axis title"] = title
4545
if title:
4646
title = _common_texification(title)
47-
self.axis_options.append(u"title={{{}}}".format(title))
47+
self.axis_options.append("title={{{}}}".format(title))
4848

4949
# get axes titles
5050
xlabel = obj.get_xlabel()
5151
xrotation = obj.xaxis.get_label().get_rotation()
5252
if xlabel:
5353
xlabel = _common_texification(xlabel)
54-
self.axis_options.append(u"xlabel={{{}}}".format(xlabel))
54+
self.axis_options.append("xlabel={{{}}}".format(xlabel))
5555
if xrotation != 0:
5656
self.axis_options.append(
57-
u"xlabel style={{rotate={}}}".format(xrotation - 90)
57+
"xlabel style={{rotate={}}}".format(xrotation - 90)
5858
)
5959
ylabel = obj.get_ylabel()
6060
yrotation = obj.yaxis.get_label().get_rotation()
6161
if ylabel:
6262
ylabel = _common_texification(ylabel)
63-
self.axis_options.append(u"ylabel={{{}}}".format(ylabel))
63+
self.axis_options.append("ylabel={{{}}}".format(ylabel))
6464
if yrotation != 90:
6565
self.axis_options.append(
66-
u"ylabel style={{rotate={}}}".format(yrotation - 90)
66+
"ylabel style={{rotate={}}}".format(yrotation - 90)
6767
)
6868

6969
# Axes limits.
@@ -573,7 +573,7 @@ def _get_ticks(data, xy, ticks, ticklabels):
573573
# must appear in the TikZ plot.
574574
if label:
575575
try:
576-
label_float = float(label.replace(u"\N{MINUS SIGN}", "-"))
576+
label_float = float(label.replace("\N{MINUS SIGN}", "-"))
577577
is_label_required = is_label_required or (label and label_float != tick)
578578
except ValueError:
579579
is_label_required = True
@@ -597,7 +597,7 @@ def _get_ticks(data, xy, ticks, ticklabels):
597597

598598
if is_label_required:
599599
axis_options.append(
600-
u"{}ticklabels={{{}}}".format(xy, u",".join(pgfplots_ticklabels))
600+
"{}ticklabels={{{}}}".format(xy, ",".join(pgfplots_ticklabels))
601601
)
602602
return axis_options
603603

tikzplotlib/_line2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def _table(obj, data): # noqa: C901
201201
elif isinstance(xdata_alt[0], str):
202202
data["current axes"].axis_options += [
203203
"xtick={{{}}}".format(",".join([ff.format(x) for x in xdata])),
204-
u"xticklabels={{{}}}".format(u",".join(xdata_alt)),
204+
"xticklabels={{{}}}".format(",".join(xdata_alt)),
205205
]
206206
xdata, ydata = transform_to_data_coordinates(obj, xdata, ydata)
207207
else:

tikzplotlib/_save.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,14 @@ def get_tikz_code(
222222
code += "\\end{tikzpicture}\n"
223223

224224
if standalone:
225-
# create a latex wrapper for the tikz
226-
# <https://tex.stackexchange.com/a/361070/13262>
225+
# When using pdflatex, this is necessary:
226+
# \\DeclareUnicodeCharacter{{2212}}{{−}}
227227
code = """\\documentclass{{standalone}}
228228
\\usepackage[utf8]{{inputenc}}
229229
\\usepackage{{pgfplots}}
230230
\\usepgfplotslibrary{{groupplots}}
231231
\\usepgfplotslibrary{{dateplot}}
232232
\\pgfplotsset{{compat=newest}}
233-
\\DeclareUnicodeCharacter{{2212}}{{−}}
234233
\\begin{{document}}
235234
{}
236235
\\end{{document}}\n""".format(

0 commit comments

Comments
 (0)