제 3 변수를 사용하여 색상을 정의하는 다채로운 산포도를 만들려고합니다. 다음 코드를 사용하는 것이 간단합니다.색깔을 정의하기 위해 제 3 변수를 사용하여 파이썬 산란 컬러 플롯을 만들 때 색상이 없음
plt.scatter(mH, mA, s=1, c=mHc)
plt.colorbar()
plt.show()
그러나 플롯의 프레임을 수정할 수있는 방법은 많지 않습니다. 나는 동시에 나는 음모의 프레임을 최적화하려고, 화려한 산포도를 만들기 위해 다음 코드를 시도하고있다 :
import numpy as np
import math
from matplotlib import rcParams
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
fig, ax = plt.subplots()
cax = ax.scatter(mH,mA,s=0.5,c=mHc) ### mH, mA, mHC are the dataset
fig.colorbar(cax)
minor_locator1 = AutoMinorLocator(6)
minor_locator2 = AutoMinorLocator(6)
ax.xaxis.set_minor_locator(minor_locator1)
ax.yaxis.set_minor_locator(minor_locator2)
ax.tick_params('both', length=10, width=2, which='major')
ax.tick_params('both', length=5, width=2, which='minor')
ax.set_xlabel(r'$m_H$')
ax.set_ylabel(r'$m_A$')
ax.set_xticks([300,600,900,1200,1500])
ax.set_yticks([300,600,900,1200,1500])
plt.savefig('mH_mA.png',bbox_inches='tight')
plt.show()
하지만 내가 가진 플롯은 흑백이다. 마커 크기 인수에 문제가있는 것처럼 보입니다. 그러나이를 수정하는 방법에 대해서는 잘 모릅니다. 작은 마커 크기를 갖고 싶습니다. 누구든지 나에게이 문제에 대한 접근을 제안 할 수 있습니다. 감사.
덕분에 많이. 그것은 매우 도움이된다. –