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

savefig messes up coordinate transformation ofannotate #4375

Closed
@PiQuer

Description

@PiQuer

I want to annotate a data point with an inset axis (matplotlib-1.4.3, Linux):

import matplotlib.pyplot as pltimport numpy as npfrom mpl_toolkits.axes_grid1.inset_locator import inset_axesx=np.linspace(0,10,200)y=np.exp(-x)*np.sin(x)fig,ax = plt.subplots(figsize=(3.39,3))ax.plot(x,y)axins=inset_axes(ax, width=0.6, height=0.6, bbox_to_anchor=(6, 0.2),bbox_transform=ax.transData)axins.axes.get_xaxis().set_visible(False)axins.axes.get_yaxis().set_visible(False)ax.annotate("",xy=(x[150],y[150]), xycoords=ax.transData,        xytext=(1, 0), textcoords=axins.transAxes,        arrowprops=dict(arrowstyle="->"))fig.savefig('example.pdf')plt.show()

This is the correct plot shown on screen:
shown
This is whatsavefig produces:
example

Apparentlysavefig changes the coordinates(1,0) from the inset axes to the parent axes for some reason.

Metadata

Metadata

Assignees

No one assigned

    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