I would like to create a geom_line
, or possibly geom_ribbon
or geom_area
, with a "fading-out" effect below the line similar to that used in the Thomson Reuters Eikon terminal.
I've tried a very simple approach based on geom_ribbon
, setting alpha based on the y value, with an idea that I could normalise it based on a based value, but received this error: Error in f(...) : Aesthetics can not vary with a ribbon
(Non-working) code example:
library( tidyverse )
library( ggplot2 )
x <- seq( 0, 99 )
y <- rnorm( 100 ) + 4
tib <- tibble( x, y )
gp <- ggplot( tib ) +
geom_ribbon( aes( x=x, ymax=y, ymin=y-1, alpha=y) ) +
geom_line( aes( x=x, y=y ) )
I would like the output to resemble the first plot in this blog post (ironically about ggplot2's geom_line
): A Detailed Guide to Plotting Line Graphs:
Or, as mentioned, the output of the Thomson Reuters Eikon terminal shown in the top of the two plots in the second image on this page: Thomson Reuters Eikon Review: