파이썬, 3D scatter plot에 annotation 설정 질문

조회수 1958회
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

%matplotlib notebook

fig = plt.figure(figsize = (10,10))
ax = fig.add_subplot(111, projection='3d')

ax.scatter(np.log10(yie[pot.index]), np.log10(price[pot.index]), np.log10(pot), 
s = 150,c = 'g' , label = 'Potassium')
ax.scatter(np.log10(yie[fib.index]), np.log10(price[fib.index]), np.log10(fib), 
s = 150, c = 'b', label = 'Fiber')
ax.scatter(np.log10(yie[iro.index]), np.log10(price[iro.index]), np.log10(iro), 
s = 150, c= 'r', label = 'Iron')
ax.scatter(np.log10(yie[cal.index]), np.log10(price[cal.index]), np.log10(cal), 
s = 150, c = 'y', label = 'Calcium')

ax.legend()
ax.set_xlabel('Yield')
ax.set_ylabel('Price per lb')
ax.set_zlabel('Nutritions')
plt.show()

파이썬 입문자 입니다 ㅠㅜ. 3D scatter plot을 만들고 legend까지 넣었는데, annotation을 넣는 방법이 있나 궁금하네요.

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

  • matplotlib - annotation 을 참고하시면 될 것 같습니다.

    본문에 적어주신 코드에 예제를 넣으려했는데요. yie, price, pot, fib등 unknown variable로 인해 코드를 실행하지 못해 레퍼런스만 적습니다.

    • (•́ ✖ •̀)
      알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)