0

I have successfully plotted the three "bridge"-objects in the same plot (with legend) using this code:

p <- lapply(list(DataT5_SDQ_network_b,
                 DataT6_SDQ_network_b,
                 DataT7_SDQ_network_b), function(x) suppressWarnings(plot(x)))

p <- Map(function(a, b) { a$data$Class <- b; a}, a = p, b = c("T5", "T6", "T7"))

p[[1]]$data <- do.call(rbind, lapply(p, function(x) x$data))

p <- p[[1]] + aes(color = Class, group = Class)

p

The result: enter image description here

Questions:

  1. How can I plot the data as z-scores?
  2. How can I get the plot only showing Bridge Expected Influence (1-step)?
Brage Kraft
  • 45
  • 1
  • 6
  • Just looked at your [recent questions](https://stackoverflow.com/users/16926673/brage-kraft?tab=questions) and noticed **1.** you never provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), and **2.** you didn't [accept an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235) for a long time. Please fix that. Cheers! – jay.sf May 12 '22 at 16:17
  • 1. There is a reproducible example here: load .Rdata with the objects, then run the code I provided. 2. In the recent question I had to wait a certain amount of time before I could tag a post as «answered». I have now tagged it as answered. The other questions which are not tagged answered is becausd they were not solved – Brage Kraft May 12 '22 at 17:19
  • It's about a **minimal** example without to download anything, as you surely read when you opened the link to our respective [guidelines](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), apologies I didn't include the adjective in my comment. Three reasons: 1. You benefit most in creating the example, 2. it stays on Stack Overflow (external links will will eventually break down), 3. the chances that you will attract good answers increase enormously! – jay.sf May 13 '22 at 04:49
  • Sorry, I tried using dput to make reproducible data, but the output is too large to post here :( – Brage Kraft May 13 '22 at 06:46
  • It's definitely cool that you considered `dput`! The idea, though, is that you create a _minimal_ example that best resembles your problem and share small example data with `dput` :) – jay.sf May 13 '22 at 07:43

1 Answers1

0

I found out:

First, plot each plot:

gg1 <- plot(DataT5_SDQ_network_b, include=c("Bridge Expected Influence (1-step)"), theme_bw=FALSE, zscore=TRUE)
gg2 <- plot(DataT6_SDQ_network_b, include=c("Bridge Expected Influence (1-step)"), theme_bw=FALSE, zscore=TRUE)
gg3 <- plot(DataT7_SDQ_network_b, include=c("Bridge Expected Influence (1-step)"), theme_bw=FALSE, zscore=TRUE)

Then combine plots

p <- list(gg1, gg2, gg3)
p <- Map(function(a, b) { a$data$Class <- b; a}, a = p, b = c("T5", "T6", "T7"))
p[[1]]$data <- do.call(rbind, lapply(p, function(x) x$data))
p <- p[[1]] + aes(color = Class, group = Class)
p
Brage Kraft
  • 45
  • 1
  • 6