[Python] Copy matplotlib artist

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I created an array of Line2D-objects with matplotlib that I'd like to use in various plots. However, using the same artist in multiple plots doesn't work since I get:

    RuntimeError: Can not put single artist in more than one figure


    As I found out, the artists once attached to an axis, cannot be attached to another anymore. Well, my idea was to simply copy the array containing the lines with copy() but it won't work. The copied array still refers to the same objects. I suppose, that is because you simply cannot copy artists (?).

    Is there any way to avoid the recalculation of the Line2Ds and to only have to calculate them once?

    Continue reading...

Compartilhe esta Página