Figure 15-4: Custom Point Markers

Portfolio Categories: All Graphics and SGR Book Graphics.

Using Alphanumerics for Point Markers

Using Alphanumerics for Point Markers

 
# Plotting other symbols: Alphanumerics ----------------------------------------
                                        # Output a png file
png(filename = "illustrations/fig-15-4-pch-letters.png",
  units = "in",                        # Set measurements in inches
  res = 1200,                          # Set resolution at 1200dpi
  width = 6,                           # Width at 6 inches
  height = 4)                          # Height at 4 inches

par(mai = c(1, 1, .25, .25))           # Set plot margins - no title

plot(x = c(1:4), y = c(2, 4, 3, 4),    # Plot some x & y values
  pch = c("g", "&", "3", "H"),         # Assign alphanumerics to each point
  cex = 2,                             # Scale symbols to double size
  xlim = c(0, 5), ylim = c(0, 5),      # Set range of plot
  xlab = "X", ylab = "Y")              # Set axis labels

dev.off()                              # Close png device to output plot