2014-07-14 6 views
0

Matplotlib의 text() 축에 적용된 함수에 linewidth 속성이 없습니다.matplotlib에서 텍스트를 조정하는 방법은 무엇입니까?

예제를 보면, 내 플롯은 대시를 성공적으로 추가하지만 플롯 자체는 우아한 lw=2을 사용하는 반면 두께는 5 오버 이상입니다.

for i in range(len(var)): 
    (x2,y2) = DATA[i] 
    ax1.text(x2, y2 , str(y2), fontdict=None, withdash=True, 
      dashdirection=1, 
      dashlength=10, 
      dashpad=5, 
      rotation=0, 
      dashrotation=90, 
      dashpush=10 
      ) 

나는 음모의 모든 라인의 라인 폭을 설정하는 SO 여기 코드의이 비트를 찾았지만 성공적으로 대시를 대상으로하지 않았다.

for ln in ax.lines: 
    ln.set_linewidth(20) 

어떻게 대시 요소를 어떻게 타겟팅 할 수 있습니까?

답변

1

문제점을 재현 할 수 없습니다.

그러나 아직 수정 사항을 알고있을 수 있습니다. 이 당신에게 제공

import matplotlib.pyplot as plt 

# create a plot with some text with a dash 
fig = plt.figure() 
ax = fig.add_subplot(111) 
t = ax.text(.5,.5, "dashtest", withdash=True, dashlength=50) 

# change some dash line properties 
dash = t.dashline 
dash.set_color('r') 
dash.set_dashes((5,5)) 
dash.set_linewidth(5) 

: 대시 라인 속성을 변경하기가 비교적 쉬운

enter image description here

속성 t.dashline는, 그래서 Line2D 인스턴스에 적용되는 서식을 적용 할 수있는 일반 Line2D 인스턴스 .

+0

Ty. Matplotlib이 클래스에서 객체를 캡슐화하는 방법에 대해이 질문에 대한 후속 조치를 요청하는 두 번째 게시를 할 것입니다. 내가 사이트에서 이것을 알아낼 수 없다면 ... – xtian

관련 문제