Activity: Improving the Default Visualization

Steps for Completion:

  1. Use the basic ggplot commands to create two of the plots from Activity B (Topic and VisitedResources).
  2. Use the Grammar of Graphics to improve your graphics by layering upon the base graphic. The graph should follow these guidelines:
    1. Histograms should be rebinned.
    2. Change the fill colors of one- and two-dimensional objects. The line colors should be black.
    3. Add a title to the graph.
    4. Apply the appropriate font sizes and colors to the x- and y-axes.

Outcome:

The complete code is as follows:

p1 <- ggplot(df_edu,aes(x=Topic))p2 <- ggplot(df_edu,aes(x=VisitedResources))p1 +    geom_bar(color=1,fill=3) +    ylab("Count")+    theme(axis.text.y=element_text(size=10), axis.text.x=element_text(size ...

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.