0

I'm trying to plot an hysteresis like curve (mean of other curves) using ggplot2, and I would like to have the area of the standard deviation appear over it.

I'm using the following code:

xlabel <- "E [V]"
ylabel <- "I[pA]"
plotdata <- data.frame(x = x21, 
                       y = probe_02_cv$Mean, 
                       lower = (probe_02_cv_m), 
                       upper = (probe_02_cv_M))

ggplot(plotdata) + 
  geom_line(aes(y = probe_02_cv$Mean, x = x21, colour = "Mean probe2")) +
  geom_ribbon(aes(ymin = lower, ymax = upper, x = x21, fill = "st.dev"), alpha = 1) +
  scale_colour_manual("", values = "blue") +
  scale_fill_manual("", values = "grey12") + 
  xlab(xlabel) + 
  ylab(ylabel)

and graphically the result isn't very readable...

enter image description here

Anyone has a good idea on how to solve this?

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • Don't use `$` inside `aes()`, just use column names. If you need more help than that try [making a reproducible example](https://stackoverflow.com/q/5963269/903061) (see link for a good how-to) either by sharing code to simulate data, sharing your data copy/pastably (use `dput()`), or using built-in data. – Gregor Thomas Oct 03 '17 at 15:57
  • tried to remove $ in aes() but no change in the graph... – Antonio D'angelo Oct 04 '17 at 08:17
  • Well, then to quote my above comment "*try making a [reproducible example (see link for a good how-to)](https://stackoverflow.com/q/5963269/903061) either by sharing code to simulate data, sharing your data copy/pastably (use dput()), or using built-in data*". – Gregor Thomas Oct 04 '17 at 13:22
  • i managed to get over it using the polygon function. thanks – Antonio D'angelo Oct 04 '17 at 13:39

0 Answers0