Docstring fix & small adjustements in demo_affine_image#6673
Docstring fix & small adjustements in demo_affine_image#6673afvincent wants to merge 2 commits intomatplotlib:masterfrom
demo_affine_image#6673Conversation
demo_affine_image
examples/api/demo_affine_image.py
Outdated
|
|
||
| # display intended extent of the image | ||
| x1, x2, y1, y2 = im1.get_extent() | ||
| x3, y3 = x2, y1 |
|
The offset between the image and rectangle does seem a bit odd... |
|
@QuLogic You're right, and I didn't pay attention enough: x3 and y3 weren't used anywhere. I also removed the import of I had an idea during the night and significantly modified the example to also show the image extent in the case where the affine transform is not applied. I've factorize the plotting of the extent rectangle and added some segment markers. However, the latters might be a bit overkill if one doesn't add a translation to the affine transorm (currently it's only a rotation). The commit 2f263b5 produces: @tacaswell I'll try to investigate the possible issue of the offset between the image and the rectangle (I guess I'll have to learn about the details of Affine2D first…). |
|
PR #6792 is not only about |

1/ Makes the red rectangle announced in the docstring red in the plot. The docstring has also been precised a bit.
2/ I think the comment about the image rotation was misplaced so I moved it where it seemed relevant to me.
3/ Finally, I've made the line width of the rectangle a bit bigger to be more visible and added a call to
plt.show()The example should now looks like:

Remark 1: the colormap is not
viridisbecause the colormap seems to default tognuplot2in my conda env. I guess I had tweaked sthg and didn't remember it.Remark 2: the red rectangle does not seem to be perfectly centered on the image: the 2 upper sides are mostly over the image, while the 2 lower sides are mostly out of it. Is it expected?