The first linked page has a if 1: "guard" while the second one has if __name__ == '__main__':. Given the overall trend in the examples, neither seems necessary.
I'll be happy to submit a PR if a couple of senior folks approve.
P.S. The reason for all this is in the comment section of https://stackoverflow.com/a/49933937/2988730, when I realized I was giving somebody incomplete, or possibly outright bad advice.
I see how it ended up in the axesgrid documentation section now. Now the question is why AnchoredArtists are part of AxesGrid in the first place though...
Please do not remove any of the userdemo examples. They are... well, part of the userdemos. In this case, the annotation guide.
I would also not recommend deleting any of the other two examples. They both make sense in the respecitve context. The one is an example of the anchored artists from axes_grid1, so it should be part of the axes_grid1 examples. The other shows how to do the same without axes_grid1. I would hence recommend to add some text to both examples explaining the context and also link to the respective other example.
The userdemo example should above all be quite short and make sense in the context of the annotations guide. What you definitely can do is bring the code in the annotations guide and the code from the example in accordance (they seem to be a bit off).
Also feel free to adjust things like if True or if __name__ if that helps the example to be easier to understand.
In general a little bit of explanations above or below the examples is always useful.
@ImportanceOfBeingErnest Besides the font and figure size, there are no significant differences between the annotations guide and the user example (once I undid my changes). What did you have in mind?
Figure size doesn't matter, because it's not in the userguide. But, yes, fontsize and linebreaks are different. And if you want to change loc=2 to loc="upper left" that should happen in both codes.
Activity
madphysicist commented on Apr 20, 2018
I see how it ended up in the axesgrid documentation section now. Now the question is why AnchoredArtists are part of AxesGrid in the first place though...
DOC: Addressed issue matplotlib#11092
ImportanceOfBeingErnest commented on Apr 20, 2018
Please do not remove any of the userdemo examples. They are... well, part of the userdemos. In this case, the annotation guide.
I would also not recommend deleting any of the other two examples. They both make sense in the respecitve context. The one is an example of the anchored artists from axes_grid1, so it should be part of the axes_grid1 examples. The other shows how to do the same without axes_grid1. I would hence recommend to add some text to both examples explaining the context and also link to the respective other example.
madphysicist commented on Apr 20, 2018
@ImportanceOfBeingErnest Thanks. That is exactly the kind of guidance I was looking for. Would it be OK to edit the user example a bit?
jklymak commented on Apr 20, 2018
@madphysicist Any edits to the examples gratefully received if they help improve understanding!
ImportanceOfBeingErnest commented on Apr 20, 2018
The userdemo example should above all be quite short and make sense in the context of the annotations guide. What you definitely can do is bring the code in the annotations guide and the code from the example in accordance (they seem to be a bit off).
Also feel free to adjust things like if True or if __name__ if that helps the example to be easier to understand.
In general a little bit of explanations above or below the examples is always useful.
DOC: Addressed issue matplotlib#11092
DOC: Addressed issue matplotlib#11092
DOC: Addressed issue matplotlib#11092
madphysicist commented on Apr 20, 2018
@ImportanceOfBeingErnest Besides the font and figure size, there are no significant differences between the annotations guide and the user example (once I undid my changes). What did you have in mind?
ImportanceOfBeingErnest commented on Apr 20, 2018
Figure size doesn't matter, because it's not in the userguide. But, yes, fontsize and linebreaks are different. And if you want to change loc=2 to loc="upper left" that should happen in both codes.
DOC: Addressed issue matplotlib#11092
story645 commented on Nov 17, 2022
Some of those user demos can probably be removed since the figures in the annotation guide are generated in the guide directly as of #23606