Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Ridge plot curves not appearing in plot in r

$
0
0

I'm trying to recreate this ridge plot:

https://i.stack.imgur.com/QAFs1.jpg

However, I can't seem to be able to get the curves to show up on the plot, As you may have guessed I'm very new to r, so I pretty much copied https://bytefish.de/blog/timeseries_databases_5_visualization_with_ggridges/ to get where I am. here's the code:

eustockmark_index <- fortify.zoo(EuStockMarkets)

eustockmark_index$Index=as.factor(eustockmark_index$Index)
eustockmark_index$Index=factor(eustockmark_index$Index,levels=c(1991,1992,1993,1994,1995,1996,1997,1998))
eustockmark_index$Index= trimws(eustockmark_index$Index)

eustockmark_index

ggplot(eustockmark_index, aes(x = `DAX`, y =`Index`,fill=..x..)) +
  geom_density_ridges_gradient() +
  labs(title = "DAX",
       x = "",
       y = "")+
  scale_fill_viridis(option = "C")

Also if any one could explain why my Y axis has NA at the top, that would be marvelous. Thanks very much!


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>