Python Forum
Matplotlib 1.43 to 1.5.2 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Matplotlib 1.43 to 1.5.2 (/thread-12650.html)



Matplotlib 1.43 to 1.5.2 - Gebbo - Sep-05-2018

I have the following code which does not give me an error with Matplotlib 1.4.* but it does with Matplotlib 1.5 upwards:

    def set_line_properties(self, line, axes=None, figure=None, color='b', linewidth=1, linestyle='-', marker=None,
                            alpha=1., transform=None, row_index=0, picker=3):
        """sets various linestyle parameters for given line object"""
        line.set_axes(axes)
        line.set_figure(figure)
        line.set_c(color)
        line.set_lw(linewidth)
        line.set_ls(linestyle)
        if marker is not None:
            line.set_marker(marker)
        line.set_alpha(alpha)
        line.set_transform(transform)
        line.row_index = row_index
        line.set_picker(picker)
        return
I think especially the first two commands pose errors.
The error output is:
Quote:line 384, in set_line_properties
line.set_axes(axes)
AttributeError: 'Line2D' object has no attribute 'set_axes'
.
If i exclude this line the error message is the following:
Quote:line 385, in set_line_properties
line.set_figure(figure)
(...)
RuntimeError: Can not put single artist in more than one figure

Does anyone have an idea how i could fix this?