title: Add p-value and r on ggplot [Follow-up]
body: <p>It is a follow-up <a href="https://stackoverflow.com/questions/39333151/add-p-value-and-r2-ggplot-follow-up">question</a>. When I run the code given below, I get a plot with two R2 and p-value but p-value = 0. It is possibly due to very small p-value. I tried increasing no. of digits to 20 (here <code>signif(..p.value.., digits = 4)</code>) but it did not work. I would rather prefer to mention exact p-value or use stars e.g., <code>if (p&lt;0.002) star='**' else if (p&gt;=0.002&amp;p&lt;0.05) star='*' else star=''</code>. In addition, I would like to have r values listed in the plot. Have a look and please let me know which part needs to be amended.  Looking forward!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Answer codes by @eipi10 for adding p-value work, but still <strong>seeking answers</strong> on adding <strong>correlation coefficient (r)</strong> in the ggplots. </p>
  
  <p>Code: </p>
  
  <pre><code>library(dplyr) 
  library(ggplot2)
  library(ggpmisc)
  
  df &lt;- diamonds %&gt;%
    dplyr::filter(cut%in%c("Fair","Ideal")) %&gt;%
    dplyr::filter(clarity%in%c("I1" ,  "SI2" , "SI1" , "VS2" , "VS1",  "VVS2")) %&gt;%
    dplyr::mutate(new_price = ifelse(cut == "Fair", 
                                     price* 0.5, 
                                     price * 1.1))
  
  formula &lt;- y ~ x - 1
  
  p &lt;- ggplot(df, aes(x,y, color=factor(cut))) 
  p &lt;- p + stat_smooth(method = "lm", formula = y ~ x-1, size = 1, level=0.95) 
  p &lt;- p + geom_point(alpha = 0.3) 
  p &lt;- p + stat_poly_eq(aes(label = paste(..rr.label..)),
                        label.x.npc = "right", label.y.npc = 0.15, formula = formula, 
                        parse = TRUE, size = 3) + 
            stat_fit_glance(method = 'lm', method.args = list(formula = formula),
                        geom = 'text', aes(label = paste("P-value = ", 
                        signif(..p.value.., digits = 4), sep = "")),label.x.npc = 'right',
                        label.y.npc = 0.35, size = 3)
  print(p)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bgFp9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bgFp9.png" alt="enter image description here"></a></p>