[Matplotlib-users] Any way to add figure string for subplots
vincent.adrien at gmail.com
vincent.adrien at gmail.com
Sun Jun 16 10:31:51 EDT 2019
Hi Jinbo,
You should be able to achieve this with `annotate`. Here is a small
snippet demonstrating its basic use:
```python
import matplotlib.pyplot as plt
plt.ion()
fig, axs = plt.subplots(ncols=2, nrows=2) # dummy 2x2 subplot grid
# NB: a better annotation tutorial is available at
# https://matplotlib.org/tutorials/text/annotations.html
for ax, label in zip(axs.flat, ["(a)", "(b)", "(c)", "(d)"]):
ax.annotate(label,
(0.02, 0.03), xycoords="axes fraction", # coordinates
ha="left", va="bottom", # horiz. & vertical alignement
weight="bold", style="italic" # font option examples
)
```
If you need to draw a white box behind the annotations, please have a
look at
https://matplotlib.org/tutorials/text/annotations.html#annotating-with-text-with-box
Hopefully this helps.
Best regards,
Adrien
Le 16/06/2019 à 10:47, 谢瑾博 a écrit :
> Dear Users,
> I am trying to do a subplot consist of several axes like one below. My
> problem is that the small figure string for each subplot (a)(b)(c), if
> there is any resource controlling this text, or I have to some other
> configurations?
> Jinbo
>
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
More information about the Matplotlib-users
mailing list