import
from
matplotlib.offsetbox
import
(
,
,
,
,
)
from
matplotlib.patches
import
,
def
draw_text
(
):
"""Draw a text-box anchored to the upper-left corner of the figure."""
box
=
(
child
=
(
"Figure 1a"
),
loc
=
"upper left"
,
frameon
=
True
)
box
.
patch
.
set_boxstyle
(
"round,pad=0.,rounding_size=0.2"
)
(
box
)
def
draw_circles
(
):
"""Draw circles in axes coordinates."""
area
=
(
width
=
40
,
height
=
20
)
area
.
add_artist
(
((
10
,
10
),
10
,
fc
=
"tab:blue"
))
area
.
add_artist
(
((
30
,
10
),
5
,
fc
=
"tab:red"
))
box
=
(
child
=
area
,
loc
=
"upper right"
,
pad
=
0
,
frameon
=
False
)
(
box
)
def
draw_ellipse
(
):
"""Draw an ellipse of width=0.1, height=0.15 in data coordinates."""
aux_tr_box
=
(
)
aux_tr_box
.
add_artist
(
((
0
,
0
),
width
=
0.1
,
height
=
0.15
))
box
=
(
child
=
aux_tr_box
,
loc
=
"lower left"
,
frameon
=
True
)
(
box
)
def
draw_sizebar
(
):
"""
Draw a horizontal bar with length of 0.1 in data coordinates,
with a fixed label center-aligned underneath.
"""
size
=
0.1
text
=
r
"1$^{\prime}$"
sizebar
=
(
)
sizebar
.
add_artist
(
([
0
,
size
],
[
0
,
0
],
color
=
"black"
))
text
=
(
text
)
packer
=
(
children
=
[
sizebar
,
text
],
align
=
"center"
,
sep
=
5
)
(
(
child
=
packer
,
loc
=
"lower center"
,
frameon
=
False
,
pad
=
0.1
,
borderpad
=
0.5
))
,
=
()
(
1
)
draw_text
(
)
draw_circles
(
)
draw_ellipse
(
)
draw_sizebar
(
)
()