I am trying to plot this data frame which has total of rows 36 * columns 7: Notes:
There are 6 factors for stim_ending_t= 1, 1.5, 2, 2.5, 3, 3.5
Three are three repeated conditons:
visbility =1 soundvolume=0 (visbility)
visbility =0 soundvolume=1 (soundvolume)
visbility = 0 soundvolume=0 (this sould be called blank or empty)
date frame name: master_all_r.csv
stim_ending_t visbility soundvolume Opening_text m sd coefVar
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
1 1 0 0 Now focus on the Image 1.70 1.14 0.670
2 1 0 0 Now focus on the Sound 1.57 0.794 0.504
3 1 0 1 Now focus on the Image 1.62 1.25 0.772
4 1 0 1 Now focus on the Sound 1.84 1.17 0.637
5 1 1 0 Now focus on the Image 3.19 17.2 5.38
6 1 1 0 Now focus on the Sound 1.59 0.706 0.444
How the plot should look like: x= Stim_ending_t , y=m
I need three lines in the same plot that satisfy the conditions above while being divided into two groups by = Opening_text. If it possible it can be in one graph, but if not the two groups (Now focus on the Image & Now focus on the Sound) can be split into two separate graphs.
I have tried this code:
ggplot(test_master, aes(x=stim_ending_t, y=m, group=Opening_text, visbility, soundvolume)) +
geom_line(aes(linetype=Opening_text, visbility, soundvolume))+
geom_point()
But got this Warning message: Duplicated aesthetics after name standardisation:
this is the result I got here
Ideally, the plot should look like this, but with three lines here . I found these plots here
If you would like to download the excel file, you can find it here under the name master_all_r.csv
I believe you are looking for something like this:
library(tidyvere)
library(readr)
test_master <- read_csv("https://raw.githubusercontent.com/MohJumper/VisualAuditoryModality/master/master_all_r.csv")
test_master %>%
mutate(visbility_sound = case_when(
visbility == 1 & soundvolume == 0 ~ "visibility",
visbility == 0 & soundvolume == 1 ~ "soundvolume",
visbility == 0 & soundvolume == 0 ~ "empty")) %>%
mutate_at(vars(visbility_sound), factor) %>%
ggplot(aes(x = stim_ending_t, y = m, color = visbility_sound)) +
geom_line(aes(linetype = visbility_sound)) +
geom_point() +
facet_wrap(~Opening_text) +
theme_minimal()
So here's what's happenning:
geom_line
to also use this column for linetype facet_wrap
(could also use facet_grid
!)
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.