Skip to content

Commit 3090414

Browse files
committed
better arrow tips
1 parent 59802ad commit 3090414

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

matplotlib2tikz/text.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,27 @@ def _annotation(obj, data, content):
144144
)
145145
return data, content
146146
else: # Create a basic tikz arrow
147+
arrow_translate = {
148+
"-": ["-"],
149+
"->": ["->"],
150+
"<-": ["<-"],
151+
"<->": ["<->"],
152+
"|-|": ["|-|"],
153+
"-|>": ["-latex"],
154+
"<|-": ["latex-"],
155+
"<|-|>": ["latex-latex"],
156+
"]-[": ["|-|"],
157+
"-[": ["-|"],
158+
"]-": ["|-"],
159+
"fancy": ["-latex", "very thick"],
160+
"simple": ["-latex", "very thick"],
161+
"wedge": ["-latex", "very thick"],
162+
}
147163
arrow_style = []
148164
if obj.arrowprops is not None:
149165
if obj.arrowprops["arrowstyle"] is not None:
150-
if obj.arrowprops["arrowstyle"] in ["-", "->", "<-", "<->"]:
151-
arrow_style.append(obj.arrowprops["arrowstyle"])
166+
if obj.arrowprops["arrowstyle"] in arrow_translate:
167+
arrow_style += arrow_translate[obj.arrowprops["arrowstyle"]]
152168
data, col, _ = color.mpl_color2xcolor(
153169
data, obj.arrow_patch.get_ec()
154170
)

0 commit comments

Comments
 (0)