I have a piece of script that delivers 2 different ggplot graphs. In the first one it outputs a black line with grey shading around it, and the second a blue line with green shading. How can I change these so they are the same?
Please post some data and the code to produce a similar graph. There is some advice in the following link about how to make such a reproducible example (reprex).
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
Sorry, unfortunately for this case I cannot share the data set, however for this graph I was able to change the line colour inside the ggplot however I am also inquiring about the shading inside the ggplot. where it is grey. I found that within the geom_line(XXXX) something can be added here to manipulate this line.
It is not necessary to show the actual data. Some invented data that leads to the same kind of plot would be fine. At the very least, please show the ggplot command that produces the plot.
Here is some invented data and a plot that is similar to yours with the shaded region in a bluish color. If the call to ggplot does not help you, perhaps you can use the data as part of your reprex.
#Inventing data vec <- sin(seq(from = 0, to = 2 * pi, by = 0.02 * pi)) vecPlus <- vec + runif(length(vec), min = 1, max = 2) vecMinus <- vec - runif(length(vec), min = 1, max = 2) DF <- data.frame(X = seq(from = 0, to = 2 * pi, by = 0.02 * pi), vec, vecPlus, vecMinus) #Plotting library(ggplot2) ggplot(DF, aes(x = X, y = vec, ymin = vecMinus, ymax = vecPlus)) + geom_line(color = "red", size = 2) + geom_ribbon(fill = "skyblue", alpha = 0.5) + theme_classic()
Created on 2020-05-27 by the reprex package (v0.3.0)