Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

4. Line Graphs > Changing the Appearance of Points

Changing the Appearance of Points

Problem

You want to change the appearance of the points in a line graph.

Solution

In geom_point(), set the size, shape, colour, and/or fill outside of aes() (the result is shown in Figure 4-14):

ggplot(BOD, aes(x=Time, y=demand)) +
    geom_line() +
    geom_point(size=4, shape=22, colour="darkred", fill="pink")
Points with custom size, shape, color, and fill

Figure 4-14. Points with custom size, shape, color, and fill

Discussion

The default shape for points is a solid circle, the default size is 2, and the default colour is "black". The fill color is relevant only for some point shapes (numbered 21–25), which have separate outline and fill colors (see Using Different Point Shapes for a chart of shapes). The fill color is typically NA, or empty; you can fill it with white to get hollow-looking circles, as shown in Figure 4-15:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint