FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/1.4.1/pyplots/annotate_transform.py at main · matplotlib/matplotlib.github.com · GitHub
matplotlib
/
matplotlib.github.com
Public
Notifications
You must be signed in to change notification settings
Fork
62
Star
29
Code
Issues
1
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
1.4.1
/
pyplots
/
annotate_transform.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (25 loc) · 899 Bytes
Breadcrumbs
matplotlib.github.com
/
1.4.1
/
pyplots
/
annotate_transform.py
Copy path
File metadata and controls
34 lines (25 loc) · 899 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
x
=
np
.
arange
(
0
,
10
,
0.005
)
y
=
np
.
exp
(
-
x
/
2.
)
*
np
.
sin
(
2
*
np
.
pi
*
x
)
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
111
)
ax
.
plot
(
x
,
y
)
ax
.
set_xlim
(
0
,
10
)
ax
.
set_ylim
(
-
1
,
1
)
xdata
,
ydata
=
5
,
0
xdisplay
,
ydisplay
=
ax
.
transData
.
transform
((
xdata
,
ydata
))
bbox
=
dict
(
boxstyle
=
"round"
,
fc
=
"0.8"
)
arrowprops
=
dict
(
arrowstyle
=
"->"
,
connectionstyle
=
"angle,angleA=0,angleB=90,rad=10"
)
offset
=
72
ax
.
annotate
(
'data = (%.1f, %.1f)'
%
(
xdata
,
ydata
),
(
xdata
,
ydata
),
xytext
=
(
-
2
*
offset
,
offset
),
textcoords
=
'offset points'
,
bbox
=
bbox
,
arrowprops
=
arrowprops
)
disp
=
ax
.
annotate
(
'display = (%.1f, %.1f)'
%
(
xdisplay
,
ydisplay
),
(
xdisplay
,
ydisplay
),
xytext
=
(
0.5
*
offset
,
-
offset
),
xycoords
=
'figure pixels'
,
textcoords
=
'offset points'
,
bbox
=
bbox
,
arrowprops
=
arrowprops
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL