# R: ggplot2 can't show the output

**URL:** <https://community.plotly.com/t/r-ggplot2-cant-show-the-output/913>\
**Category:** Plotly R\
**Created:** [April 25, 2016, 8:22am UTC](https://community.plotly.com/t/r-ggplot2-cant-show-the-output/913 "2016-04-25T08:22:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![much](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@much](https://community.plotly.com/u/much)\
**Post date:** [April 25, 2016, 8:22am UTC](https://community.plotly.com/t/r-ggplot2-cant-show-the-output/913/1 "2016-04-25T08:22:42Z")

</div>

When i use the plotly with ggplot2 and dplyr,i hava some problem.The problem as follow:  
code1:  
p \<- plot\_ly(economics, x = date, y = uempmed)  
p %\>%  
layout(title = “Median duration of unemployment (in weeks)”,showlegend = FALSE) %\>%  
dplyr::filter(uempmed == max(uempmed)) %\>%  
layout(annotations = list(x = date, y = uempmed, text = “Peak”, showarrow = T))

code2:  
p \<- ggplot(data=economics,aes(x=date,y=uempmed))  
p \<- p+geom\_line()  
p  
gg \<- ggplotly§  
gg %\>%  
layout(title = “Median duration of unemployment (in weeks)”) %\>%  
dplyr::filter(uempmed == max(uempmed)) %\>%  
layout(annotations = list(x = date, y = uempmed, text = “Peak”, showarrow = T))

the code1 is ok to run ,but the code2 can’t have the output with the error" ‘options’ must be a fully named list, or have no names (NULL)".  
anyone can solve this problem

---

<div class="post-metadata">

**Author:** ![timelyportfolio](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@timelyportfolio](https://community.plotly.com/u/timelyportfolio)\
**Post date:** [May 4, 2016, 2:47pm UTC](https://community.plotly.com/t/r-ggplot2-cant-show-the-output/913/2 "2016-05-04T14:47:36Z")

</div>

This one is very tricky. I am looking into it.
