r - Add filename or other annotation to ggplot figures -
I use ggplot to create most of my graphics, these can be single panels, or be bold. To make the modification easier to track, I would like to produce a small label in the corner of the plot that contains some text.
In a phony code, I'm looking for something like this: Initial plot p < - ggplot () # Label P + Add some encryption function (label = "version 1.0", x = 1, y = 0, hasz = "right", vjust = "bottom") # print print (p)
Or: plot my labels in the lower right corner of my statistics without messing up existing garglet graphics.
There is no luck finding a solution yet. The (very interesting) method does not work if you have a complete Based on the comment of Baptiste, using a Now our plot is, and this move adds to that label Saving the entire conspiracy by using # label to show sub-label = text which gives you: mxn table of tables
grid extras < Ways to use / code> are messed up with plots. So, is there any way to add arbitrary text anywhere on a plot that was produced using ggplot?
gridExtra () The solution is:
is required ("ggplot2") required ("grid extra") # Set up our working directory directory Dir & lt; - '/ user / eclipse / document / project / rccode' set wd (working directory) # one data frame df & lt; - Data.frame (x = rediff (100, 1, 10), y = reninif (100, 1, 10) # one plot p> - Create ggplot (data = df, aes (x = x, y = y)) + geom_point () print (p)
("some type of label" , Gp = gaper (font size = 6), x = unit (1, "npc"), hjust = 1, vjust = 0) ggsave (filename = file.path (work.dir, 'demotlate .png'), plot = ArrangeGrob (p, sub = sub.label, clip = FALSE), scale = 1, width = 6.5, height = 3.5, units = C ("in"), dpi = 300)
Comments
Post a Comment