y_values = [2, 3, 5, 7, 11] colors = ['red', 'blue', 'green', 'cyan', 'magenta'] # 使用颜色列表绘制散点图 plt.scatter(x_values, y_values, s=100, c=colors, marker='o') # 添加标题和轴标签 plt.title('Color List Scatter Plot') plt.xlabel('X-axis') plt.ylabel('Y-axi...
colors = ['lightgreen', 'pink', 'yellow', 'skyblue', 'cyan', 'silver', 'lightcoral', 'orange', 'violet'] percent = ['11%', '2%', '3%', '33%', '12%', '15%', '18%', '5%', '2%'] chart = sf.plot(sizes = y, label = x, color = colors, value = percent, edgeco...
单色 装了seaborn扩展的话,在字典seaborn.xkcd_rgb中包含所有的xkcd crowdsourced color names。如下: 代码语言:javascript 代码运行次数:0 plt.plot([1,2],lw=4,c=seaborn.xkcd_rgb['baby poop green']) 虽然觉得上面的已经够用了,但是还是备份一下这个最全的吧。 渐变色: 混色...
plt.pie(values, colors = color_set) plt.show() 1. 2. 3. 4. 5. 6. Tips:饼图接受使用colors参数(注意,此处是colors,而不是在plt.plot()中使用的color)的颜色列表。但是,如果颜色数少于输入值列表中的元素数,那么plt.pie()将循环使用颜色列表中的颜色。在示例中,使用包含四种颜色的列表,为包含六个...
custom_cmap = LinearSegmentedColormap.from_list("custom_cmap", colors, N=10) 使用colormap生成颜色 colors = custom_cmap(np.linspace(0, 1, 10)) 绘图 for i in range(len(x)): plt.plot(x[i], y[i], 'o', color=colors[i])
labellist= ['sleeping','eating','working','studing','playing'] colorlist = ['c','y','b','r','g']plt.stackplot(days, sleeping,eating,working,studing,playing,labels=labellist,colors=colorlist) plt.xlabel('x') plt.ylabel('y') ...
for patch, color in zip(box_plot['boxes'], colors): patch.set(facecolor=color) # 设置箱子两端线的属性 for whisker in box_plot['whiskers']: whisker.set(color='purple', linewidth=2) # 设置顶端和末端线条的属性 for cap in box_plot['caps']: ...
()#设置循环的颜色colors=['b','g','r']# 循环绘制每个温度下的充放电曲线,并指定相同的颜色foriinrange(len(temps)):ax.plot(x,voltages1.iloc[:,i],'-',color=colors[i],label=f'Temperature{temps[i]}℃')ax.plot(x,voltages2.iloc[:,i],'--',color=colors[i],label=f'Temperature{temps...
python for-loop plot data-visualization 我正在开发一个for循环来为类分配数字,我在这方面很成功,但是我发现很难根据使用相同for循环的类的数量同时插入不同的颜色,但是我得到了一个错误:'list'对象不能解释为整数 代码如下: n_class = 5 colors = ['r', 'g', 'b', 'y','k', 'y'] # plotting ...
import matplotlib.pyplot as pltimport matplotlib.colors as colorsimport numpy as np# 定义颜色列表color_list = ['#ff9999', '#66b3ff', '#99ff99', '#ffcc99']cmap = colors.ListedColormap(color_list)# 创建类别数据categories = ['A', 'B', 'C', 'D']values = [1, 2, 3, 4]# 使用...