2014-09-17 4 views
0

필자는 APLpy를 사용하여 맞는 파일을 플롯하고 특정 ra, dec 값에서 맞는 파일에 마커를 오버 플로팅하려고합니다. 마커의 색상을 다른 매개 변수로 코딩하려면 크기를 지정하십시오.APLpy는 컬러 맵으로 정규화 된 마커를 표시합니다.

그래서 내가 TEXTFILE에서 (positions.dat) 마커의 좌표와 해당 크기를 읽을 수 있습니다 무엇을 : 나는 컬러 맵과 정상화 정의

ra   = np.genfromtxt('positions.dat', dtype=float, comments='%', delimiter=';', missing_values='_', skip_header=1, usecols = (0))         
dec  = np.genfromtxt('positions.dat', dtype=float, comments='%', delimiter=';', missing_values='_', skip_header=1, usecols = (1))         
magnitude = np.genfromtxt('positions.dat', dtype=float, comments='%', delimiter=';', missing_values='_', skip_header=1, usecols = (2))         

을 :

cmap1 = mpl.cm.YlOrBr               
norm1 = mpl.colors.Normalize(10,20)               

내 positions.dat 파일의 크기는 코드를 테스트하는 데 모두 10에서 20 사이입니다.

ValueError: Color array must be two-dimensional 

positions.dat 파일이 다음과 같습니다 :

나는이 작업을 수행 할 때

fits1.show_markers(ra,dec, cmap=cmap1, norm=norm1, edgecolor=magnitude, facecolor='none', marker='x', s= 4, linewidths=0.8) 

, 나는 항상 오류가 다음과 같이

나는 마커를 그릴려고
ra ;  dec  ; magnitude 
330.45 ; -31.958333 ;  10.0 
330.46 ; -31.958333 ;  11.0 
330.47 ; -31.958333 ;  12.0 
330.48 ; -31.958333 ;  13.0 
330.49 ; -31.958333 ;  14.0 
330.50 ; -31.958333 ;  15.0 
330.51 ; -31.958333 ;  16.0 
330.52 ; -31.958333 ;  17.0 
330.53 ; -31.958333 ;  18.0 
330.54 ; -31.958333 ;  19.0 
330.55 ; -31.958333 ;  20.0 
+0

http://stackoverflow.com/questions/21767526/value-error-with-color- : 당신이 뭘 하려는지 달성하는 올바른 방법이 경우에, 그래서 분산의 c 인수를 사용하는 것입니다 배열 - 슬라이스 - 값 - 분산 형 - 플롯 – Iguananaut

답변

1

matplotlib의 스 캐터는 edgecolorfacecolor 번째 값을 취할 수 없습니다. at는 색상 배열 (RGB 값의 배열)이 아닙니다. 관련

fits1.show_markers(ra,dec, cmap=cmap1, norm=norm1, 
        c=magnitude, facecolor='none', 
        marker='x', s=4, linewidths=0.8)