Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8517d37

Browse files
authored
Merge pull request #11669 from matplotlib/auto-backport-of-pr-10877-on-v2.2.x
Fix invalid escape sequences on branch v2.2.x
2 parents 711bb3f + 11f9d85 commit 8517d37

File tree

16 files changed

+20
-17
lines changed

16 files changed

+20
-17
lines changed

examples/api/power_norm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100)
2626

2727
for ax, gamma in zip(axes.flat[1:], gammas):
28-
ax.set_title('Power law $(\gamma=%1.1f)$' % gamma)
28+
ax.set_title(r'Power law $(\gamma=%1.1f)$' % gamma)
2929
ax.hist2d(data[:, 0], data[:, 1],
3030
bins=100, norm=mcolors.PowerNorm(gamma))
3131

examples/recipes/fill_between_alpha.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow')
8282
ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5)
8383
ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5)
84-
ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval')
84+
ax.set_title(r'random walkers empirical $\mu$ and $\pm \sigma$ interval')
8585
ax.legend(loc='upper left')
8686
ax.set_xlabel('num steps')
8787
ax.set_ylabel('position')

examples/recipes/placing_text_boxes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
mu = x.mean()
2121
median = np.median(x)
2222
sigma = x.std()
23-
textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$' % (mu, median, sigma)
23+
textstr = '\n'.join((
24+
r'$\mu=%.2f$' % (mu, ),
25+
r'$\mathrm{median}=%.2f$' % (median, ),
26+
r'$\sigma=%.2f$' % (sigma, )))
2427

2528
ax.hist(x, 50)
2629
# these are matplotlib.patch.Patch properties

examples/shapes_and_collections/path_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
================
33
PathPatch object
44
================

examples/text_labels_and_annotations/arrow_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
213213
coords = np.dot(orig_position, M) + [[x_pos, y_pos]]
214214
x, y = np.ravel(coords)
215215
orig_label = rate_labels[pair]
216-
label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
216+
label = r'$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
217217

218218
plt.text(x, y, label, size=label_text_size, ha='center', va='center',
219219
color=labelcolor or fc)

examples/ticks_and_spines/spines_bounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# set ticks and tick labels
2323
ax.set_xlim((0, 2*np.pi))
2424
ax.set_xticks([0, np.pi, 2*np.pi])
25-
ax.set_xticklabels(['0', '$\pi$', '2$\pi$'])
25+
ax.set_xticklabels(['0', r'$\pi$', r'2$\pi$'])
2626
ax.set_ylim((-1.5, 1.5))
2727
ax.set_yticks([-1, 0, 1])
2828

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ def acorr(self, x, **kwargs):
18441844
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
18451845
def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
18461846
usevlines=True, maxlags=10, **kwargs):
1847-
"""
1847+
r"""
18481848
Plot the cross correlation between *x* and *y*.
18491849
18501850
The correlation with lag k is defined as sum_n x[n+k] * conj(y[n]).
@@ -5595,7 +5595,7 @@ def _pcolorargs(funcname, *args, **kw):
55955595
@_preprocess_data(label_namer=None)
55965596
@docstring.dedent_interpd
55975597
def pcolor(self, *args, **kwargs):
5598-
"""
5598+
r"""
55995599
Create a pseudocolor plot with a non-regular rectangular grid.
56005600
56015601
Call signature::

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def remove_coding(text):
346346
r"""
347347
Remove the coding comment, which six.exec\_ doesn't like.
348348
"""
349-
sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
349+
sub_re = re.compile(r"^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
350350
return sub_re.sub("", text)
351351

352352
#------------------------------------------------------------------------------

setupext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,7 @@ def check(self):
20512051
output = check_output('latex -version', shell=True,
20522052
stderr=subprocess.STDOUT)
20532053
line = output.splitlines()[0].decode()
2054-
pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)'
2054+
pattern = r'(3\.1\d+)|(MiKTeX \d+.\d+)'
20552055
match = re.search(pattern, line)
20562056
return "version %s" % match.group(0)
20572057
except (IndexError, ValueError, AttributeError, subprocess.CalledProcessError):

tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
category=DeprecationWarning)
3434
warnings.filterwarnings(
3535
'default',
36-
'.*inspect.getargspec\(\) is deprecated.*',
36+
r'.*inspect.getargspec\(\) is deprecated.*',
3737
category=DeprecationWarning)
3838

3939
from matplotlib import test

tutorials/text/annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
Annotations
33
===========
44

tutorials/text/pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
*********************************
33
Typesetting With XeLaTeX/LuaLaTeX
44
*********************************

tutorials/text/usetex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
*************************
33
Text rendering With LaTeX
44
*************************

tutorials/toolkits/axes_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
==============================
33
Overview of axes_grid1 toolkit
44
==============================

tutorials/toolkits/axisartist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
==============================
33
Overview of axisartist toolkit
44
==============================

versioneer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
469469
print("unable to run %s (error)" % dispcmd)
470470
return None
471471
return stdout
472-
LONG_VERSION_PY['git'] = '''
472+
LONG_VERSION_PY['git'] = r'''
473473
# This file helps to compute a version number in source trees obtained from
474474
# git-archive tarball (such as those provided by githubs download-from-tag
475475
# feature). Distribution tarballs (built by setup.py sdist) and build

0 commit comments

Comments
 (0)