I have a dataframe df
. I want to plot two variables, a
and t
, against each other, but using only certain rows. The rows I want to use must meet three conditions:
s
, must be >= 0.9 s
must also be <=1.1 a
, t
, and s
. I have created a logical vector that returns values of TRUE
and FALSE
to meet this third condition, but I don't know how to work this into my code.
Here is my code so far, which I believe produces the desired result with the exception of the third condition:
plot(log(df$t)[df$s >= .9 & df$s <= 1.1],log(df$a)[df$s >= .9 & df$s <= 1.1])
What can I add to it to satisfy the third condition?
library(ggplot2)
p <- ggplot(data=df[df$s >= 0.9 & df$s <= 1.1 & !is.na(df$a) & !is.na(df$s) & !is.na(df$t),])
p + geom_point(aes(x = t, y = a))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.