I want to add a table with some info that will be different in each panel within the facet. I'm using ggplot2 and facet_grid.
say I want to add some kind of descriptive statistics to each panel, and they not necessarily the same. these statistics are placed in a df I made for that purpose.
I found a few way to add these table to the graphs but:
- as far as I concern Annotate will give me the same table for all the panels in the facet.
- I would really like to use the facet_warp for the simplicity and not grid_extra...
library(datasets)
data(mtcars)
ggplot(data = mpg, aes(x = displ, y = hwy, color = drv)) +
geom_point() +
facet_wrap( ~ cyl,scales="free_y")
the place of the table is not that important to me, but I don't want it to overlap the graph.
My objective is kind of mixture between the two answers in that thread: Adding table to ggplot with facets
The first answers (with annotate-) won't work for me since I want the table in each of the plot to be unique.) The second answer is better, but I do not want it to overlap or hide some of the details in the graph, and in each panel the lines/scatters located in different place so I can't use it like that. I would like it to be attached just like in the annotate.