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

Skip to content

Backport PR #21051 on branch v3.5.x (set_dashes does not support offset=None anymore.) #21069

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
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: 2 additions & 4 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,15 +914,13 @@ def set_dashes(self, dash_offset, dash_list):

Parameters
----------
dash_offset : float or None
dash_offset : float
The offset (usually 0).
dash_list : array-like or None
The on-off sequence as points.
The on-off sequence as points. None specifies a solid line.

Notes
-----
``(None, None)`` specifies a solid line.

See p. 107 of to PostScript `blue book`_ for more info.

.. _blue book: https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
Expand Down
22 changes: 1 addition & 21 deletions src/py_converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,33 +212,13 @@ int convert_dashes(PyObject *dashobj, void *dashesp)
{
Dashes *dashes = (Dashes *)dashesp;

if (dashobj == NULL && dashobj == Py_None) {
return 1;
}

PyObject *dash_offset_obj = NULL;
double dash_offset = 0.0;
PyObject *dashes_seq = NULL;

if (!PyArg_ParseTuple(dashobj, "OO:dashes", &dash_offset_obj, &dashes_seq)) {
if (!PyArg_ParseTuple(dashobj, "dO:dashes", &dash_offset, &dashes_seq)) {
return 0;
}

if (dash_offset_obj != Py_None) {
dash_offset = PyFloat_AsDouble(dash_offset_obj);
if (PyErr_Occurred()) {
return 0;
}
} else {
if (PyErr_WarnEx(PyExc_FutureWarning,
"Passing the dash offset as None is deprecated since "
"Matplotlib 3.3 and will be removed in Matplotlib 3.5; "
"pass it as zero instead.",
1)) {
return 0;
}
}

if (dashes_seq == Py_None) {
return 1;
}
Expand Down