Questions tagged [geom-ribbon]

37 questions
5
votes
1 answer

CI/SD geom_ribbon() missing when zoomed in

I have an issue with geom_ribbon and I think this is a bug and not a feature. I want to zoom in on the "interesting" part of my plot but I don't want ggplot to exclude anything just because the entire thing doesn't fit into the plot. For that I use…
Gunnar
  • 97
  • 5
3
votes
1 answer

Area under curve ggplotly R not rendering as per expectation

I have created a plot with the following dataset and ggplot2 I downloaded the dataset in CSV from the below link https://www.kaggle.com/dataset/e392d3cfbb5749653d5c82f4bec1daa03628fb06d374fad84eac319f1b3f982422 The code I have used is as follows …
Raghavan vmvs
  • 1,213
  • 1
  • 10
  • 29
3
votes
1 answer

How to make a ribbon plot with variables from different datasets?

I have been plotting from multiple data.frames; ggplot() + geom_line(data=posterior.m, aes(x=time,y=NO.y)) + geom_line(data=posterior.05, aes(x=time,y=NO.y), linetype = "dotted") + geom_line(data=posterior.95, aes(x=time,y=NO.y),…
emilk
  • 75
  • 5
2
votes
3 answers

geom_ribbon with confidence intervals

I would expect the following snippet to print the 95% confidence intervals of the length of the sepals: ggplot(iris,aes(x=Species,y=Sepal.Length)) + stat_summary(geom='ribbon', fun=mean_cl_normal, …
NicolasBourbaki
  • 853
  • 1
  • 6
  • 19
2
votes
1 answer

Change path order of geom_ribbon() from default

I have an issue with geom_ribbon(). I am displaying the change of two different variables for several years. I fail to understand how to make geom_ribbon follow the path for years instead of connecting the data points according to the increase of…
Steffen
  • 79
  • 11
2
votes
2 answers

Control colours on double geom_ribbon for two variables with ggplot2 in R

I want to show two ribbons per variable e.g. (max - min ribbon, and a confidence level ribbon) with geom_ribbon() in ggplot2 in R, as in the example below. I've not been able to set the colours for each ribbon separately. Ideally, I can map a colour…
CCID
  • 1,368
  • 5
  • 19
  • 35
2
votes
2 answers

Colour area above y-lim in geom_ribbon

How can I colour the area between y=0 and the datapoints in green? At the moment it is colouring the whole y [0:1] Variable <- c(1,2,3,4,5,6,7) value <- c(-0.26, -0.10,0.98,0.52, 0.31, -0.63, -0.70) df <- data.frame(Variable, value) …
Ecg
  • 908
  • 1
  • 10
  • 28
2
votes
1 answer

Draw the space between two lines for anomalies

Hi I want to draw the space between two lines with red and blue( representing the anomalies), but I don't succeed to make it. Only blue anomaly is drawn. Here is my code : library(RCurl) t <-…
Alex.V
  • 45
  • 8
2
votes
1 answer

How to change plotting order with multiple geoms and a factor in ggplot2

I'm trying to make a plot with a line and two ribbons for each of three factor levels (factor named block). This is my call to ggplot2: ggplot(df, aes(x = x, y = y, fill = block, color = block)) + geom_ribbon(aes(ymin = llb, ymax = uub), alpha =…
YanivA
  • 21
  • 5
1
vote
1 answer

geom_ribbon: Fill area between lines - spurious lines connecting groups

I'm trying to build a plot with two lines and fill the area between with geom_ribbon. I've managed to select a fill color (red/blue) depending on the sign of the difference between two lines. First I create two new columns in the dataset for ymax,…
pacomet
  • 5,011
  • 12
  • 59
  • 111
1
vote
2 answers

How to use geom_ribbon to plot?

I am using 'flights' data set from 'nycflights13' package and 'ggplot2' package to convert the code using stat_summary function into the one using geom_ribbon(), geom_line(), and geom_point() functions. Here is the original code: flights %>%…
1
vote
1 answer

R - ggplot - geom_ribbon() makes spikey / jagged plot for groups

I'm working with a growth curve model (generated with lmer) and would like to add confidence intervals to the model plot using geom_ribbon(). (The full R code can be downloaded here and the data set is here.) #Fit…
Nick
  • 13
  • 4
1
vote
1 answer

Unable to plot confidence intervals using ggplot, (geom_ribbon() argument)

I am trying to plot 95% confidence intervals on some simulated values but am running into so issues when i am trying to plot the CIs using the geom_ribbon() argument. The trouble I'm having it that my model does not show the CIs when i plot them,…
Joe
  • 795
  • 1
  • 11
1
vote
1 answer

geom_ribbon() with shape aesthetic causes differences in opacity

When using geom_ribbon() with the shape aesthetic, there appears to be a difference in the opacity on the shaded area creating blocks in the region. I have recreated the problem where I identified that these opacity changes are only present when the…
Aveshen Pillay
  • 431
  • 3
  • 13
1
vote
1 answer

How to replace the default `geom_ribbon` with `geom_errorbar` in `ggcompetingrisks` from `survminer` package?

How to replace the default geom_ribbon with geom_errorbar in ggcompetingrisks from survminer package? conf.int = T will put confidence interval as a ribbon layer. my code: library(cmprsk);library(survminer) set.seed(2) ss <- rexp(100) gg <-…
Mohamed Rahouma
  • 1,084
  • 9
  • 20
1
2 3