This wasn't plagiarism, it was duplication of content that already exists on SO. That's also a bad thing, and is usually avoidable, including in this case. Deletion was appropriate, IMO, but the message chosen was not great.
Separate from actual attribution, you are still earning rep from basically repackaging someone else's answer with minor tweaks. It's not a big deal for you, already having plenty of rep, but it's not a precedent we want to allow for people to do in general. If there was a case where an adapted answer had more value than a link, it would be ok. (But that would probably require more work adapting it, meaning that the user posting it would be more deserving of the rep they got.)
The best thing is for that canonical Q&A about sizing figures in Matplotlib to link to the Q&A about doing it in centimetres. So if people want that, they can find it and go there for the current best way. Answers to that special case only need to be maintained in one place, where a new answer can be added if the library ever does get metric support. Unlike off-site links, link rot isn't a concern.
How to link related questions:
Stack Overflow doesn't have a first-class mechanism for hand-curated lists of related Q&As, so normally this comes down to a bullet list at the bottom of an existing answer. Or sometimes the question, especially for canonical Q&As. As in Editing old questions to add links to similar ones
(Not a link-only answer, though; even without the link-rot concern, an answer isn't the right place for just a link or a list of links. Even if community-wiki. It's likely going to be buried and hard to find, because what would people be voting on? The curation effort? And a list of links to related questions wouldn't even be answering the actual question it was posted under.)
A comment (under the question, or an appropriate answer) is another good place to add a Related: link, especially on lower-traffic questions where questions won't need to be cleaned up periodically. (So probably not this canonical, although it's better than nothing even then, and maybe someone will add it to their answer.) It would look like this.
Related: Specify figure size in centimeter in matplotlib
I use https://stackapps.com/questions/2378/se-comment-link-helper to turn URLs into question titles, making it super easy to copy/paste links into readable comments. In this case the title is self-explanatory, otherwise you might add some text describing why someone would want to look at it. (If the question title can be improved, do that).
Depending on how much value there is in making it more visible, you might comment instead of edit only if there isn't a deep comment thread so it will be visible without people having to click "see more". Otherwise editing a Related:
* url
list into a canonical question or an existing answer is good, if it can be done without being too intrusive.
Comments being good for this is less true on high-traffic canonical Q&As because comments tend to be more frequent, leading to them getting nuked periodically whether they're useful or not. (This is one of the worst features of Stack Overflow, that there's nowhere officially non-ephemeral to add value to an answer other than editing yourself, or more importantly to explain why an answer to a conceptual question is wrong or outdated despite having lots of upvotes.)
In practice useful comments usually don't get deleted; the policy that any comment can be deleted at any time only works if it's not applied randomly, especially on low-traffic questions. (Although popular questions do sometimes need cleaning as comments build up, and it's understandable but unfortunate that mods don't always have the time to selectively keep highly upvoted comments there. Much less understandable when they nuke useful comments from obscure low-traffic questions.)
Multiple people have argued that if the same answer is appropriate for two questions, they should be closed as duplicates. Neither direction of dup closing would be appropriate in this case. But if not for the existence of the metric Q&A, an answer about doing it in cm
would be fully on-topic on the general Q&A. (Franck's argument makes a lot of sense, that many parts of the world use metric units by default, so that's not some obscure use-case.)
Specify figure size in centimeter in matplotlib is focused on that problem. Since Matplotlib apparently doesn't directly support centimetres, the answers are about extra stuff you need to do, and wouldn't be good for people looking for the basics of how to set plot sizes or use the library at all.
How do I change the size of figures drawn with Matplotlib? is a generic canonical Q&A where the question body just repeats the title, and one of the high-ranked answers (from Ciro) is a whole tutorial with examples. But it's not about cm
or metric, so the metric question shouldn't be closed as a duplicate of this or merged.
Since SO does have a whole Q&A for that special case, of using metric units, the general canonical Q&A should link that, because many people might be looking for that.