I am studying a bachelor's degree and over the past few months I have been teaching myself R. I just started trying ggplot and ran into some troubles. I made a series of crates, looking at the depth of the fish at different acoustic receiving stations. I would like to add a scatter chart that shows the depths of the receiving stations. This is what I have so far:
data <- read.csv(".....MPS.csv", header=TRUE)
df <- data.frame(f1=factor(data$Tagging.location),
f2=factor(data$Station),data$Detection.depth)
df2 <- data.frame(f2=factor(data$Station), data$depth)
df$f1f2 <- interaction(df$f1, df$f2)
plot1 <- ggplot(aes(y = data$Detection.depth, x = f2, fill = f1), data = df) +
geom_boxplot() + stat_summary(fun.data = give.n, geom = "text",
position = position_dodge(height = 0, width = 0.75), size = 3)
plot1+xlab("MPS Station") + ylab("Depth(m)") +
theme(legend.title=element_blank()) + scale_y_reverse() +
coord_cartesian(ylim=c(150, -10))
plot2 <- ggplot(aes(y=data$depth, x=f2), data=df2) + geom_point()
plot2+scale_y_reverse() + coord_cartesian(ylim=c(150,-10)) +
xlab("MPS Station") + ylab("Depth (m)")
, , . x - "" ( 12 ), y - "" (0-150 ). ( 2 ). , .
, , "plot2" ( ) "plot1" boxplots ( ). ( ) Y.
, , R, ggplot , . !