concept geom_segment() in category R

appears as: geom_segment()
Exploring Data with R

This is an excerpt from Manning's book Exploring Data with R.

Now that the nyc_highlow_temps table is ready to use, let’s make a lollipop plot! This type of plot will use one of the value types in nyc_highlow_temps: "max_temp". The combination of ggplot geoms to use involves the geom_segment() and geom_point() functions. Order is important here, if the statements are reversed then the line segments will partially overlap the points. The choice which columns are passed to the x and y aesthetics determines whether this will be a horizontal or a vertical lollipop plot. Let’s opt for a plot of the horizontal variety and map value to x and month to y in geom_point(). There are four required aesthetics for geom_segment(): x, xend, y, and yend. Have a look at Listing 11.3 for how the lollipop plot is generated, and, Figure 11.1 for the result.