#!/usr/bin/python # -*- coding: UTF-8 -*- import matplotlib.pyplot as plt x=[i for i in range(-20,20)] y=[i**2 for i in x] # plt.plot(x,y) # plt.plot(x,y,color="red",linestyle="-.",marker="o") #linestyle="dashed"虚线 marker="o"表示标记为圆圈 # plt.plot(x,y,"ro-") "ro-"表示红色线,标记为圆圈 简写 # plt.show() z=[i*2 for i in x] plt.plot(x,y,"ro-",x,z,"g-",[2*i for i in x ],z,"bo-") plt.show() # character color # ‘b’ blue # ‘g’ green # ‘r’ red # ‘c’ cyan # ‘m’ magenta # ‘y’ yellow # ‘k’ black # ‘w’ white # character description # '-' solid line style # '--' dashed line style # '-.' dash-dot line style # ':' dotted line style # '.' point marker # ',' pixel marker # 'o' circle marker # 'v' triangle_down marker # '^' triangle_up marker # '<' triangle_left marker # '>' triangle_right marker # '1' tri_down marker # '2' tri_up marker # '3' tri_left marker # '4' tri_right marker # 's' square marker # 'p' pentagon marker # '*' star marker # 'h' hexagon1 marker # 'H' hexagon2 marker # '+' plus marker # 'x' x marker # 'D' diamond marker # 'd' thin_diamond marker # '|' vline marker # '_' hline marker