2017-08-03 31 views
2

this question中,解釋了在xlabel/ylabel中生成一個箭頭。解釋了一個例子:xlabel/ylabel中繪製的箭頭如何在matplotlib中放大/縮小?

import matplotlib.pyplot as plt 
fig, ax = plt.subplots(1, 1) 
# plot your data here ... 

ax.set_xlabel(r'$\rho/\rho_{ref}\;\rightarrow$', color='red') 
ax.set_ylabel(r'$\Delta \Theta/\omega \longrightarrow$') 

plt.show() 

得到的下面:

.

怎會規模在其中不縮放文本僅箭頭?

+1

我將藉此機會宣傳[這套功能我寫的(https://github.com/saintsfan342000/MPL-a-al-SKK)格式化matplotlib以適合我顧問口味的方式呈現。他也喜歡在軸標上放置箭頭。我使用FancyArrow實現了它們。看看教程。 – saintsfan342000

回答

1

如果您使用LaTeX來呈現文本(使用rcParams),那麼您可以使用LaTeX大小命令來更改文本的部分。例如:

import matplotlib.pyplot as plt 
plt.rcParams['text.usetex'] = True 

fig, ax = plt.subplots(1, 1) 

ax.set_xlabel(r'$\rho/\rho_{ref} \;$ \Huge{$ \rightarrow $}', color='red') 
ax.set_ylabel(r'$\Delta \Theta/\omega $ \Huge{$\longrightarrow$}') 

plt.show() 

enter image description here