Skip to content

Prefer "none" to "None" in docs, examples and comments. #21041

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 1 commit into from
Sep 11, 2021
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
6 changes: 3 additions & 3 deletions examples/axes_grid1/inset_locator_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
bbox_transform=ax.transAxes, loc=3)

# For visualization purposes we mark the bounding box by a rectangle
ax.add_patch(plt.Rectangle((.2, .4), .6, .5, ls="--", ec="c", fc="None",
ax.add_patch(plt.Rectangle((.2, .4), .6, .5, ls="--", ec="c", fc="none",
transform=ax.transAxes))

# We set the axis limits to something other than the default, in order to not
Expand All @@ -89,9 +89,9 @@
bbox_transform=ax3.transAxes)

# For visualization purposes we mark the bounding box by a rectangle
ax2.add_patch(plt.Rectangle((0, 0), 1, 1, ls="--", lw=2, ec="c", fc="None"))
ax2.add_patch(plt.Rectangle((0, 0), 1, 1, ls="--", lw=2, ec="c", fc="none"))
ax3.add_patch(plt.Rectangle((.7, .5), .3, .5, ls="--", lw=2,
ec="c", fc="None"))
ec="c", fc="none"))

# Turn ticklabels off
for axi in [axins2, axins3, ax2, ax3]:
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/marker_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def split_list(a_list):
fig.suptitle('Mathtext markers', fontsize=14)
fig.subplots_adjust(left=0.4)

marker_style.update(markeredgecolor="None", markersize=15)
marker_style.update(markeredgecolor="none", markersize=15)
markers = ["$1$", r"$\frac{1}{2}$", "$f$", "$\u266B$", r"$\mathcal{A}$"]

for y, marker in enumerate(markers):
Expand Down
2 changes: 1 addition & 1 deletion examples/shapes_and_collections/compound_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

path = Path(vertices, codes)

pathpatch = PathPatch(path, facecolor='None', edgecolor='green')
pathpatch = PathPatch(path, facecolor='none', edgecolor='green')

fig, ax = plt.subplots()
ax.add_patch(pathpatch)
Expand Down
4 changes: 2 additions & 2 deletions examples/statistics/errorbars_and_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r',
edgecolor='None', alpha=0.5):
edgecolor='none', alpha=0.5):

# Loop over data points; create box from errors at each point
errorboxes = [Rectangle((x - xe[0], y - ye[0]), xe.sum(), ye.sum())
Expand All @@ -55,7 +55,7 @@ def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r',

# Plot errorbars
artists = ax.errorbar(xdata, ydata, xerr=xerror, yerr=yerror,
fmt='None', ecolor='k')
fmt='none', ecolor='k')

return artists

Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3317,8 +3317,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
%(Line2D:kwdoc)s
"""
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
# anything that comes in as 'None', drop so the default thing
# happens down stream
# Drop anything that comes in as None to use the default instead.
kwargs = {k: v for k, v in kwargs.items() if v is not None}
kwargs.setdefault('zorder', 2)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ def cla(self):
self.patch = self._gen_axes_patch()
self.patch.set_figure(self.figure)
self.patch.set_facecolor(self._facecolor)
self.patch.set_edgecolor('None')
self.patch.set_edgecolor('none')
self.patch.set_linewidth(0)
self.patch.set_transform(self.transAxes)

Expand Down
18 changes: 9 additions & 9 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,15 +1093,15 @@ def set_linestyle(self, ls):

- A string:

=============================== =================
Linestyle Description
=============================== =================
``'-'`` or ``'solid'`` solid line
``'--'`` or ``'dashed'`` dashed line
``'-.'`` or ``'dashdot'`` dash-dotted line
``':'`` or ``'dotted'`` dotted line
``'None'`` or ``' '`` or ``''`` draw nothing
=============================== =================
========================================== =================
linestyle description
========================================== =================
``'-'`` or ``'solid'`` solid line
``'--'`` or ``'dashed'`` dashed line
``'-.'`` or ``'dashdot'`` dash-dotted line
``':'`` or ``'dotted'`` dotted line
``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing
========================================== =================

- Alternatively a dash tuple of the following form can be
provided::
Expand Down
21 changes: 9 additions & 12 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,18 +419,15 @@ def set_linestyle(self, ls):
"""
Set the patch linestyle.

=========================== =================
linestyle description
=========================== =================
``'-'`` or ``'solid'`` solid line
``'--'`` or ``'dashed'`` dashed line
``'-.'`` or ``'dashdot'`` dash-dotted line
``':'`` or ``'dotted'`` dotted line
``'None'`` draw nothing
``'none'`` draw nothing
``' '`` draw nothing
``''`` draw nothing
=========================== =================
========================================== =================
linestyle description
========================================== =================
``'-'`` or ``'solid'`` solid line
``'--'`` or ``'dashed'`` dashed line
``'-.'`` or ``'dashdot'`` dash-dotted line
``':'`` or ``'dotted'`` dotted line
``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing
========================================== =================

Alternatively a dash tuple of the following form can be provided::

Expand Down
3 changes: 1 addition & 2 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3033,8 +3033,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
had_data = self.has_data()

kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
# anything that comes in as 'None', drop so the default thing
# happens down stream
# Drop anything that comes in as None to use the default instead.
kwargs = {k: v for k, v in kwargs.items() if v is not None}
kwargs.setdefault('zorder', 2)

Expand Down