python draw dotted line

plot(x, y) #default is blue solid line
plot(x, y, 'r*') #red star mark
plot(x, y, 'go-') #green line with circle markers
plot(x, y, 'ks:') # black dotted line with square markers

Basic color format commands for plotting with the PyLab library
colour  
‘b’ blue
'g' green
'r' Red
'c' Blue
'm' quality
'and' yellow
'k' black
'w' White
Basic line format commands for plotting with the PyLay library
 
line type  
'-' solid line
'--' dotted line
':' Dotted line
Basic drawing marker formatting commands for drawing with the LyLab library
 
mark  
'.' point
'O' circle
's' square
'*' star
'+' plus
'x' Cross

 

PlotDataItem plot line format command
line type  
dotted line
--
 
QtCore.Qt.DashLine
 
solid line
-
 
QtCore.Qt.CustomDashLine
 
Dotted line.-
 
DashDotLine
 
Dotted line.
 
DotLine
 
dotted line..-
 
DashDotDotLine
custom dotted line
CustomDashLine
eg:
self.curveLowerLimit=pg.PlotDataItem()
# 虚线DashLine -- ,实线SolidLine -,点划线DashDotLine,点线DotLine,点点线DashDotDotLine,定制虚线CustomDashLine
# pen = pg.mkPen(color="w", width=1, style=QtCore.Qt.CustomDashLine)
# pen.setDashPattern([1, 4, 5, 4])
pen = pg.mkPen(color="w", width=1,style=QtCore.Qt.DashLine)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324948062&siteId=291194637