Issue 1:
Bug report

I am trying to use np.polyfit function. I have been using this for quite some time, but yesterday realize that something is broken. First I use a polyfit to find a line arguments then I plot the graph, but when trying to call polyfit for the second time, it produce the error, even thou I am calling the same function with the same arguments.

raise LinAlgError("SVD did not converge in Linear Least Squares")

numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares

Bug summary

import numpy as np
import matplotlib.pyplot as plt

import numpy.polynomial.polynomial as poly

x = np.linspace(0, 1e-5*10000, 10000, endpoint=False)
y = np.random.random(10000)
coef = poly.polyfit(x, y, 1)[::-1]
print(coef)

x_fit = np.zeros(2)
x_fit[:] = [x[0], x[-1]]
y_fit = x_fit*coef[0] + coef[1]

plt.plot(x, y, linewidth=0.1)
plt.plot(x_fit, y_fit, linewidth=2, linestyle='--', color='red')
plt.show()
plt.close("all")

coef = poly.polyfit(x[1:], y[1:], 1)[::-1]
print(coef)

#

Actual outcome

# If applicable, paste the console output here
[0.21593069 0.48646648]
** On entry to DLASCLS parameter number 4 had an illegal value
** On entry to DLASCLS parameter number 4 had an illegal value
** On entry to DLASCLS parameter number 4 had an illegal value
** On entry to DLASCLS parameter number 4 had an illegal value
** On entry to DLASCLS parameter number 5 had an illegal value
** On entry to DLASCLS parameter number 4 had an illegal value
Traceback (most recent call last):
File "polyfit_example.py", line 31, in <module>
coef = poly.polyfit(x[1:], y[1:], 1)[::-1]
File "C:\python38\lib\site-packages\numpy\polynomial\polynomial.py", line 1350, in polyfit
return pu._fit(polyvander, x, y, deg, rcond, full, w)
File "C:\python38\lib\site-packages\numpy\polynomial\polyutils.py", line 706, in _fit
c, resids, rank, s = np.linalg.lstsq(lhs.T/scl, rhs.T, rcond)
File "<__array_function__ internals>", line 5, in lstsq
File "C:\python38\lib\site-packages\numpy\linalg\linalg.py", line 2306, in lstsq
x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
File "C:\python38\lib\site-packages\numpy\linalg\linalg.py", line 100, in _raise_linalgerror_lstsq
raise LinAlgError("SVD did not converge in Linear Least Squares")
numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares#
#

Expected outcome

Matplotlib version

Operating system:

Win10 64bit

python-3.8.5-amd64

Matplotlib 3.3.2

numpy-1.19.2

pip install numpy

pip install matplotlib

Issue 2:
Bug report

Bug summary

savgol_filter crashes with an error in the lstsq algorithm if executed after a plot with dashed/dotted/dashdotted line style.

Code for reproduction

import matplotlib.pyplot as plt
from scipy.signal import savgol_filter

ls='--'
# ls=''
y = range(100)
plt.plot(y,ls)
try:
y_filt=savgol_filter(y,11,2)
except Exception as e:
print(e)

Actual outcome

** On entry to DLASCLS parameter number 4 had an illegal value
** On entry to DLASCLS parameter number 4 had an illegal value
SVD did not converge in Linear Least Squares

Expected outcome

It worked until recently without a change in any of the python libraries. I had it running in a fixed environment and it stopped working probably after a windows update. Now I can't get it to work on any PC with any python version.

Matplotlib version

Operating system: Windows 10.0.19041

Matplotlib version: 3.1.1

Matplotlib backend (print(matplotlib.get_backend())): TkAgg

Python version: 3.7.4

Jupyter version (if applicable): NA

Other libraries: scipy v1.5.2

installed python from the installer and the libraries with pip