2012年10月1日 星期一

ggplot2 Shapes and line types

Link

Note that the filled symbols 15-18 often render without proper anti-aliasing; they can appear jagged, pixelated, and not properly centered. Use symbols 19 and 21-25 to avoid these problems. For symbols 21-25 to appear solid, you will also need to specify a fill (bg) color that is the same as the outline color (col); otherwise they will be hollow.





Use the pch option to set the shape, and use lty and lwd to 
set the line type and width. The line type can be specified 
by name or by number. 
 
  
set.seed(331)

# Plot some points with lines
# Set up the plotting area
plot(NA, xlim=c(1,4), ylim=c(0,1))

# Plot solid circles with solid lines
points(1:4, runif(4), type="b", pch=19)
# Add open squares with dashed line, with heavier line width
points(1:4, runif(4), type="b", pch=0,  lty=2, lwd=3)

points(1:4, runif(4), type="b", pch=23,   # Diamond shape
       lty="dotted", cex=2,               # Dotted line, double-size shapes
       col="#000099", bg="#FF6666")       # blue line, red fill
 
 
 
 

沒有留言:

張貼留言