2016-05-26 19 views
0

我正在用matplotlib和seaborn繪製一些傳遞函數。用matplotlib製作清醒地塊

這就是我正在做的地塊至今格式:

enter image description here

enter image description here

它被莫名其妙地亂了,我會更喜歡做類似這樣的情節:

enter image description here

垂直顯示y標籤Vo/Vi,行tt他結束了軸,只顯示曲線的峯值。

matplotlib或seaborn中有預設樣式來獲得這種情節?

+1

沒有在規定的解決方案,但你可以使用相同的方法從這裏:http://stackoverflow.com/a/17690294/1867876 –

回答

3

下面應該工作:

import matplotlib.pyplot as plt 
x = [0, 1, 2, 3] 
y = [0, 1, 2, 3] 
plt.plot(x, y) 
plt.ylabel('$\\frac{V_i}{V_o}$', rotation=0, size=25) 
plt.xlabel('$D$') 
ax = plt.gca() 
ax.set_yticks([max(y)]) 
ax.set_xticks([max(x)]) 
plt.hlines([max(y)], 0 ,max(x), linestyles='--') 
plt.vlines([max(x)], 0, max(y), linestyles='--') 
plt.axis([0, 4, 0, 4]) 
plt.show() 

enter image description here

+1

要使用plt.gca()。spin ['top']。set_visible(False) – Andi