简体   繁体   中英

How do I plot a scatterplot graph with a repeated-measures variable and a continuous variable in r?

I have a four levels repeated measures variable (let's call it RM) and I have a continuous variable predictor (let's call it C). I want to plot a scatterplot graph with C on the X-Axis and RM on the Y-Axis with different lines within the plot for each level of RM. Is this possible to do with ggplot or a similar package? Thanks in advance!

Utilizing ggplot2, you should be able to achieve this type of graphical output. Viewing a portion of your data that you wish to plot would be beneficial to provide a sufficient answer.

I have attached a link to a summary of ggplot2 graphical functions here . This link provides some background on ggplot2 and the components necessary to create a graph. Three components are needed in ggplot2 to make a graph, the data, the ggplot2 function, and mapping your variables with the aesthetic.

Because you don't have a representation of some of your data, providing a sufficient answer is difficult, but it might look something like this.

ggplot(data=yourdata, aes(x= C(continuous_variable, y = RM(repeated_measures)) + geom_point()

You may also map geom_line for each RM variable in addition to this example. Hope this helps!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM