I’m in the process of converting a legacy matplotlib script (v1.3.1 - legacy MacOS version) to v3.5.1. When I send the line plot to savefig, I get the following traceback:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/patheffects.py", line 101, in draw_path
path_effect.draw_path(self._renderer, gc, tpath, affine,
AttributeError: 'str' object has no attribute 'draw_path'
The method in question (from patheffects.py):
def draw_path(self, gc, tpath, affine, rgbFace=None):
for path_effect in self._path_effects:
path_effect.draw_path(self._renderer, gc, tpath, affine,
rgbFace)
I modified the draw_path method to inspect the self._path_effects object; it comes through as ['[]']. Not sure why the ‘path_effect’ object is coming through as a string. I don’t get the error when running the script under v1.3.1.
We expects lists in matplotlibrc to be without [ or ] and to be , seperated so we are reading this as "a single element list with the string value '[]'".
That makes perfect sense and also points to the fact that this error is pretty much on me. I’m dumping my rcParams to a style sheet in order to migrate to a more static set of styles and doing that by writing them out to a file. This results in lists being written to file in typical Python style. This is obviously easy to handle and–beyond that–rather than write out all the parms, I’m only going to only write out the changes.
Sorry if that was an unnecessary sidetrack. Cheers!