I'm trying to highlight some text using the highlight_text library:
s= '<Jugador1> and <Jugador2> Premier League Passing Stats'
highlight_text.fig_text(s=s,
x=.18, y=.90,
#highlight_weights = ['bold'],
fontsize=22,
fontfamily = 'Andale Mono',
color = text_color,
highlight_textprops=[{"color": 'red', "fontweight": "bold"},
{"color": 'blue', "fontweight": "bold"}],
va='center'
)
I want to define jugador1 and jugador2 in the function like so:
multi_beeswarm(Jugador1 = 'F. Zampedri', Jugador2 = 'L. Martínez Dupuy', background = '#313332')
How can I break the <> so that it takes the input set in the function and not the literal jugador1 and jugador2?
Expected output: 'F. Zampedri and L. Martínez Dupuy Premier League Passing Stats'
You can use f-string formatting:
s = f"<{Jugador1}> and <{Jugador2}> Premier League Passing Stats"
highlight_text.fig_text(s=s,
x=.10, y=.92,
highlight_textprops=[{"color": "red", "fontweight": "bold"},
{"color": "blue", "fontweight": "bold"}],
va="center"
)