Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug summary
If I rasterized artists inDrawingArea
, they are rendered correctly in rasterized backend but will be misplaced in the vectorized backend
Code for reproduction
importmatplotlib.pyplotaspltfrommatplotlib.offsetboximportAnchoredOffsetbox,DrawingAreafrommatplotlib.patchesimportRectanglefrommatplotlib.collectionsimportPatchCollectionforbackendin ["png","pdf","svg"]:forrasterizedin [True,False]:fig,ax=plt.subplots(figsize=(2,2))box=DrawingArea(10,10)rects=PatchCollection([Rectangle((0,i),width=10,height=1,ec="red")foriinrange(10) ])rects.set_rasterized(rasterized)box.add_artist(rects)canvas=AnchoredOffsetbox(child=box,loc="center",pad=0)ax.add_artist(canvas)fig.savefig(f"DA_rasterized={rasterized}.{backend}")
Actual outcome
When setrasterized=True
and in backendsvg
orpdf
:
In other situations, it's properly render:
Expected outcome
This is expected in any situation:
Additional information
No response
Operating system
OS/X arm
Matplotlib Version
3.9.1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.10.13
Jupyter version
4.1.1
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels