Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

patches.Scatter() andpatches.Plot() should be added. #29318

Closed
Labels
@hyperkai

Description

@hyperkai

Problem

Only usingpatches.Rectangle() ofplt.subplots() works properly as shown below:

fromtorchvision.datasetsimportCelebAmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)rect=Rectangle(xy=(x,y),width=w,height=h,linewidth=3,edgecolor='r',facecolor='none',clip_on=True)# Hereaxis.add_patch(p=rect)# Here

Screenshot 2024-12-16 012242

And only usingaxes.Axes.scatter() ofplt.subplots() works properly as shown below:

fromtorchvision.datasetsimportCelebAimporttorchvisionmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefrommatplotlib.patchesimportCirclefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)forpx,pyinlm.split(2):# Hereaxis.scatter(x=px,y=py,c='#1f77b4')# Here

Screenshot 2024-12-16 020807

And only usingaxes.Axes.plot() ofplt.subplots() works properly as shown below:

fromtorchvision.datasetsimportCelebAimporttorchvisionmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefrommatplotlib.patchesimportCirclefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)px= []# Herepy= []# Hereforj,vinenumerate(lm):# Hereifj%2==0:# Herepx.append(v)# Hereelse:# Herepy.append(v)# Hereaxis.plot(px,py)# Here

Screenshot 2024-12-16 021239

But usingpatches.Rectangle() ofplt.subplots() withaxes.Axes.scatter() ofplt.subplots() doesn't work properly as shown below:

fromtorchvision.datasetsimportCelebAmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)rect=Rectangle(xy=(x,y),width=w,height=h,linewidth=3,edgecolor='r',facecolor='none',clip_on=True)# Hereaxis.add_patch(p=rect)# Hereforpx,pyinlm.split(2):# Hereaxis.scatter(x=px,y=py,c='#1f77b4')# Here

Screenshot 2024-12-16 012506

And usingpatches.Rectangle() ofplt.subplots() withaxes.Axes.plot() ofplt.subplots() doesn't work properly as shown below:

fromtorchvision.datasetsimportCelebAmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)rect=Rectangle(xy=(x,y),width=w,height=h,linewidth=3,edgecolor='r',facecolor='none',clip_on=True)# Hereaxis.add_patch(p=rect)# Herepx= []# Herepy= []# Hereforj,vinenumerate(lm):# Hereifj%2==0:# Herepx.append(v)# Hereelse:# Herepy.append(v)# Hereaxis.plot(px,py)# Here

Screenshot 2024-12-16 013942

So instead, I usedpatches.Rectangle() ofplt.subplots() withpatches.Circle() ofplt.subplots(), then they properly work as shown below:

fromtorchvision.datasetsimportCelebAmy_data=CelebA(root="data",split="all",target_type=["bbox","landmarks"])importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectanglefrommatplotlib.patchesimportCirclefig,axes=plt.subplots(nrows=2,ncols=5,figsize=(12,6))for (im, ((x,y,w,h),lm)),axisinzip(my_data,axes.ravel()):axis.imshow(X=im)rect=Rectangle(xy=(x,y),width=w,height=h,linewidth=3,edgecolor='r',facecolor='none',clip_on=True)# Hereaxis.add_patch(p=rect)# Hereforpx,pyinlm.split(2):# Hereaxis.add_patch(p=Circle(xy=(px,py)))# Here

Screenshot 2024-12-16 014626

Proposed solution

So, it seems likematplotlib.patches works withmatplotlib.patches sopatches.Scatter() andpatches.Plot() should be added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp