Here is an example of how to create a histogram using ggplot2 in R:
main.r261 chars10 lines
In this example, we are using the ggplot2
library to create the histogram. We first create an example dataset with 1000 random values using R's rnorm
function.
Next, we use the ggplot
function to create the plot and specify the values
column in the dataset as the x-axis variable. We add a geom_histogram
layer to create the histogram with a light blue fill color and black outline. Finally, we add a title and axis labels using the labs
function.
This produces a simple and visually appealing histogram that is easy to interpret.
gistlibby LogSnag