Question 2: Make a histogram of Sepal.Length that compares distributions for all 3 species in the same graph. Note that color= changes the color of lines and fill= changes the color of the fill!’
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#not quite sure why color= and fill= wasn’t changing anything in this case? I first tried to get it to automatically do it based on species by making color=species but this didn’t function. Just kidding I figured it out!
Question 3: Make a boxplot that shows how Sepal.Length differs by Species. Remove the gray background (there are many ways to do that– any way you want is fine).
Question 4: Make a bar graph that shows Sepal.Length by species. Is this a good graph or no? Consider the aspects of good vs bad graphs in the tutorial.
I don’t think this is a great graph because the stacking of the species on top of each other within a sepal length makes it difficult to compare sepal length across species. It is very similar to the boxplot previously made so I am not sure that I actually made the graph you were looking for.
Question 5: Make a scatter plot that shows Sepal.Length by species. Compare this to your bar graph. Which is more useful and why?
This chart, in my opinion is far more useful than the initial bar graph because it is easier to see both the distribution of sepal lengths within species and to compare the minx, max, and perceived average across species.
Question 6: Make a line graph comparing Sepal.Length and Sepal.Width by species. What do you see? This is often the kind of graph we pair with a linear regression, so thinking about what it shows us is important.
Generally, as sepal length increases, so does sepal width, but this is a very irregular relationship with plenty of variability. The increase in width is much greater (relative to length) for the sectosa species than the other species, as shown by the steeper slope of the red line.
I changed the size and shape of the points in the graph by changing their settings within the aes frame.
Question 9:
lab2graph9 <-ggplot(data=irisdata, aes(x=Species, y=Sepal.Length, color=Species)) +geom_point() +theme_minimal()+labs(x ='Species', y='Sepal Length', title='Flower Sepal Length by Species')+#what do I put at the start of this to make the plot change the title etc? in your example you use "labs" which I thought was maybe referring to the name of your product or dataframe? theme(text=element_text(size=18))lab2graph9
Question 10: Take the graph from 6 and facet_wrap() it by species