2
我使用下面的python代碼繪製了一個圖(附件)。問題是分配的顏色很難讓人們分辨每個數據點之間的差異。我想自定義色階。有人能幫忙嗎?非常感謝!如何自定義python DataFrame散點圖的顏色?
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
x=[1,2,3,4,5,1,2,3,4,5]
y=[5,4,3,2,1,1,2,3,4,5]
z=[0.1,0.2,-0.1,0.3,0.05,0.1,-0.1,-0.5,0.25,-0.05]
df=pd.DataFrame({'x':x,'y':y,'z':z})
df.plot.scatter(x='x',y='y',c='z')