12 June 2021 18:43 Chapter 3 Simple Plots - we use ggplot() o Histograms can be produced using the hist() function. o Box plots can be produced using the boxplot() function. - geom_boxplot() o Bar graphs can be produced using the barplot() function. o Scatter plots can be produced using the plot() function - geom_point() = scatter plot we load up these packages is using library() o The x and y variables are defined using aes() o The coordinates are altered in a very simple way by changing the x and y axis limits using xlim() and ylim() o Changing axis labels using xlab() and ylab() o The THEME is changed by applying the minimal theme using theme_minimal(). Hist <- ggplot(data, aes(x=eyesite, y=haircolour)) · ggplot(data ... sets up the data " aes(x = eyesight) specifies the basic aesthetics " geom_histogram( ... sets up the basic geometry " aes(y = .. density .. ) tweaks the y aesthetic to show a density rather than count histogram " xlim(-10, 15) sets the x coordinates " theme_classic() specifies the theme " colour = 'black' sets colour to black " fill = 'mistyrose4' fills colour to pink We need to pick the right geometry function from that code (remember: these begin with geom()) Example: hist <- ggplot(data = data, aes(x = eyesight)) + geom_histogram(aes(y = .. density .. ), fill = 'mistyrose4', colour = 'black') + xlim(-10, 15) + theme_classic() hist