但是我想用彩色的点,于是就这样写plt.scatter(x=Movie['rank'],y=Movie['RatingNum'],c=Movie['Rating10'],edgecolors='face',s=80),就没有右侧的颜色条了,怎么显示出右侧的颜色条呢?
发现加上一个plt.colorbar()就ok了
准备三个数据集,一个是原始数据,还有两个分别是原始数据+一定值;原始数据-一定值。用Axes对象的fill_between方法,将两个处理过的数据线条之间,用淡蓝色填充就可以了。
color('red','blue')#颜色(‘画笔色’,‘填充色’)begin_fill() #从这里开始_填充()??????图形??????形状end_fill() #从这里结束_填充()。
示例代码# 导入Tkinter模块
from tkinter import *
# 创建一个窗口
window = Tk()
# 定义一个函数,用来生成图形
def generate_shape():
# 使用随机数生成不同的图形和颜色
shape = random.choice(["circle", "square", "triangle"])
color = random.choice(["red", "green", "blue"])
# 使用随机数生成不同的位置
x = random.randint(0, 200)
y = random.randint(0, 200)
# 在窗口中绘制图形
if shape == "circle":
# 绘制圆形
canvas.create_oval(x, y, x + 50, y + 50, fill=color)
elif shape == "square":
# 绘制正方形
canvas.create_rectangle(x, y, x + 50, y + 50, fill=color)
else:
# 绘制三角形
points = [x, y, x + 50, y + 50, x + 25, y + 75]
canvas.create_polygon(points, fill=color)
# 创建一个画布
canvas = Canvas(window, width=200, height=200)
canvas.pack()
# 创建一个按钮
button = Button(window, text="Start", command=generate_shape)
button.pack()
# 进入消息循环
window.mainloop()