2024-04-09
The first function in building graph is the ggplot
It specify the data frame to be used and aesthetics
The mapping are placed with aes
function
load package
geom_
functiongeom_point
function to create a plotgeom_smooth
layerscale_
functionfacet_
functionggplot(
data = chinook,
aes(x = tl, y = w)
)+
geom_point(
alpha = .7,
size = 3)+
geom_smooth(
method = "lm",
se = TRUE,
)+
scale_x_continuous(breaks = c(25,75,105), name = "Total length (mm)")+
scale_y_continuous(breaks = c(5,15), name = "Weight (gm)")+
labs(
title = "Relationship between length and weight of Chinook",
subtitle = "Sampled in three sites of Argentina",
caption = "https:semba-blog.netlify.app/"
)
theme_
ggplot(
data = chinook,
aes(x = tl, y = w)
)+
geom_point(
alpha = .7,
size = 3)+
geom_smooth(
method = "lm",
se = TRUE,
)+
scale_x_continuous(breaks = c(25,75,105), name = "Total length (mm)")+
scale_y_continuous(breaks = c(5,15), name = "Weight (gm)")+
labs(
title = "Relationship between length and weight of Chinook",
subtitle = "Sampled in three sites of Argentina",
caption = "https:semba-blog.netlify.app/"
)+
theme_minimal(base_size = 40)
In Figure 1…
I am grateful for the insightful comments offered by the anonymous peer reviewers at Books & Texts. The generosity and expertise of one and all have improved this study in innumerable ways and saved me from many errors; those that inevitably remain are entirely my own responsibility.