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

How to add sample size used in plotting geom_jitter

$
0
0

I want to add how many samples were added to a graph, next to my stat_cor (ggpubr) text.

I'm using the following code to generate the graph:

dataset = mtcars

 ggplot(dataset,  aes(dataset$wt, dataset$disp)) +
 geom_jitter()  +
 geom_smooth(level=0.95, method = "loess") +
 stat_cor(method="spearman") + 
 theme_classic()

But, if I want to plot multiple graphs in one figure, which uses a real data set where different variables have different missing values, it would be nice to have my sample size used to plot the geom_jitter.


Viewing all articles
Browse latest Browse all 201977

Trending Articles



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