Skip to content

Commit 2d39143

Browse files
committed
Discourage alternate strings for 'none' linestyle
Inspired by but independent of the discussion around the representation of linestyles matplotlib#29304. For other linestyles we have a short visual representation (e.g. "--") and a name (dashed "dashed"). No linestyle currently has four accepted writings "", " ", "none", "None". This PR recommends only to use "" (visual representation) and "none" (named representation). It discourages " " and "None". This should guide users towards more canonical usage. We may later decide whether to deprecate the alternatives. Note also, that we have not used the alternatives in examples.
1 parent 3aebcb7 commit 2d39143

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/matplotlib/lines.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,15 +1152,15 @@ def set_linestyle(self, ls):
11521152
11531153
- A string:
11541154
1155-
========================================== =================
1156-
linestyle description
1157-
========================================== =================
1158-
``'-'`` or ``'solid'`` solid line
1159-
``'--'`` or ``'dashed'`` dashed line
1160-
``'-.'`` or ``'dashdot'`` dash-dotted line
1161-
``':'`` or ``'dotted'`` dotted line
1162-
``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing
1163-
========================================== =================
1155+
======================================================== ================
1156+
linestyle description
1157+
======================================================== ================
1158+
``'-'`` or ``'solid'`` solid line
1159+
``'--'`` or ``'dashed'`` dashed line
1160+
``'-.'`` or ``'dashdot'`` dash-dotted line
1161+
``':'`` or ``'dotted'`` dotted line
1162+
``' '`` or ``'none'`` (discouraged: ``'None'``, ``' '``) draw nothing
1163+
======================================================== ================
11641164
11651165
- Alternatively a dash tuple of the following form can be
11661166
provided::

lib/matplotlib/patches.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,15 @@ def set_linestyle(self, ls):
445445
"""
446446
Set the patch linestyle.
447447
448-
========================================== =================
449-
linestyle description
450-
========================================== =================
451-
``'-'`` or ``'solid'`` solid line
452-
``'--'`` or ``'dashed'`` dashed line
453-
``'-.'`` or ``'dashdot'`` dash-dotted line
454-
``':'`` or ``'dotted'`` dotted line
455-
``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing
456-
========================================== =================
448+
======================================================== ================
449+
linestyle description
450+
======================================================== ================
451+
``'-'`` or ``'solid'`` solid line
452+
``'--'`` or ``'dashed'`` dashed line
453+
``'-.'`` or ``'dashdot'`` dash-dotted line
454+
``':'`` or ``'dotted'`` dotted line
455+
``' '`` or ``'none'`` (discouraged: ``'None'``, ``' '``) draw nothing
456+
======================================================== ================
457457
458458
Alternatively a dash tuple of the following form can be provided::
459459

0 commit comments

Comments
 (0)