-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed as not planned
Labels
Description
Problem
I use plt.text
to annotate tags of triangles and nodes like figure below:
plt.text
only takes one x
, one y
and one text
at a time. This is:
- inconvenient to use because a loop is needed for array-like data,
- and inefficient when numerous tags are needed to be tagged.
I use PyCharm to profile plt.text
when facing numerous tags, and find set_text
and _get_layout
cost a long time.
I suppose Matplotlib read-in current figure and almost re-draw a new figure at each time I call plt.text
. This is obviously inefficient.
Proposed solution
Array-like input is needed. The ideal call case is like:
x_arr = [1, 2, 3, 4, 5]
y_arr = [1, 2, 3, 4, 5]
text_arr = ["a", "b", "c", "d", "e"]
plt.text(x_arr, y_arr, text_arr)
The expected result is:
This is easier to use and more efficient (maybe) in numerous data because only one time to read-in the old figure and re-draw a new figure.
Thanks! :smile