Skip to content

Fix invalid escape sequences on branch v2.2.x #11669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/api/power_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100)

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

Expand Down
2 changes: 1 addition & 1 deletion examples/recipes/fill_between_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow')
ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5)
ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5)
ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval')
ax.set_title(r'random walkers empirical $\mu$ and $\pm \sigma$ interval')
ax.legend(loc='upper left')
ax.set_xlabel('num steps')
ax.set_ylabel('position')
Expand Down
5 changes: 4 additions & 1 deletion examples/recipes/placing_text_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
mu = x.mean()
median = np.median(x)
sigma = x.std()
textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$' % (mu, median, sigma)
textstr = '\n'.join((
r'$\mu=%.2f$' % (mu, ),
r'$\mathrm{median}=%.2f$' % (median, ),
r'$\sigma=%.2f$' % (sigma, )))

ax.hist(x, 50)
# these are matplotlib.patch.Patch properties
Expand Down
2 changes: 1 addition & 1 deletion examples/shapes_and_collections/path_patch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
================
PathPatch object
================
Expand Down
2 changes: 1 addition & 1 deletion examples/text_labels_and_annotations/arrow_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
coords = np.dot(orig_position, M) + [[x_pos, y_pos]]
x, y = np.ravel(coords)
orig_label = rate_labels[pair]
label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
label = r'$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])

plt.text(x, y, label, size=label_text_size, ha='center', va='center',
color=labelcolor or fc)
Expand Down
2 changes: 1 addition & 1 deletion examples/ticks_and_spines/spines_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# set ticks and tick labels
ax.set_xlim((0, 2*np.pi))
ax.set_xticks([0, np.pi, 2*np.pi])
ax.set_xticklabels(['0', '$\pi$', '2$\pi$'])
ax.set_xticklabels(['0', r'$\pi$', r'2$\pi$'])
ax.set_ylim((-1.5, 1.5))
ax.set_yticks([-1, 0, 1])

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ def acorr(self, x, **kwargs):
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
usevlines=True, maxlags=10, **kwargs):
"""
r"""
Plot the cross correlation between *x* and *y*.

The correlation with lag k is defined as sum_n x[n+k] * conj(y[n]).
Expand Down Expand Up @@ -5595,7 +5595,7 @@ def _pcolorargs(funcname, *args, **kw):
@_preprocess_data(label_namer=None)
@docstring.dedent_interpd
def pcolor(self, *args, **kwargs):
"""
r"""
Create a pseudocolor plot with a non-regular rectangular grid.

Call signature::
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def remove_coding(text):
r"""
Remove the coding comment, which six.exec\_ doesn't like.
"""
sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
sub_re = re.compile(r"^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
return sub_re.sub("", text)

#------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,7 @@ def check(self):
output = check_output('latex -version', shell=True,
stderr=subprocess.STDOUT)
line = output.splitlines()[0].decode()
pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)'
pattern = r'(3\.1\d+)|(MiKTeX \d+.\d+)'
match = re.search(pattern, line)
return "version %s" % match.group(0)
except (IndexError, ValueError, AttributeError, subprocess.CalledProcessError):
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
category=DeprecationWarning)
warnings.filterwarnings(
'default',
'.*inspect.getargspec\(\) is deprecated.*',
r'.*inspect.getargspec\(\) is deprecated.*',
category=DeprecationWarning)

from matplotlib import test
Expand Down
2 changes: 1 addition & 1 deletion tutorials/text/annotations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
Annotations
===========

Expand Down
2 changes: 1 addition & 1 deletion tutorials/text/pgf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
*********************************
Typesetting With XeLaTeX/LuaLaTeX
*********************************
Expand Down
2 changes: 1 addition & 1 deletion tutorials/text/usetex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
*************************
Text rendering With LaTeX
*************************
Expand Down
2 changes: 1 addition & 1 deletion tutorials/toolkits/axes_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
==============================
Overview of axes_grid1 toolkit
==============================
Expand Down
2 changes: 1 addition & 1 deletion tutorials/toolkits/axisartist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
==============================
Overview of axisartist toolkit
==============================
Expand Down
2 changes: 1 addition & 1 deletion versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
print("unable to run %s (error)" % dispcmd)
return None
return stdout
LONG_VERSION_PY['git'] = '''
LONG_VERSION_PY['git'] = r'''
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
Expand Down