r - How to use an image as a point in ggplot? -


Is there a way to use a specific small image as a point in a scatter plane with ggplot2? Ideally, I would like to resize images based on a variable.

Here's an example:

  Library (GG Plot 2) p < - ggplot (MTC, AE (wt, mpg)) p + geom_point (aes (size = qsec, size = factor))  

So I basically want to know that Is there a way to provide a specific image

here to display raster images instead of numbers A minimalist geom, replace it with the named list with the

  Library (ggplot2) library (grid) ## to display ## rastergrob .flaglist & lt; 1), "fr" = matrix (c ("blue", "white", "red"), 1)) - list ("ar" = matrix (c ("blue", "white", "blue"), 1) Flaggrab & lt; - function (x, y, country, size = 1, alpha = 1) {grob (x = x, y = y, country = country, size = size, cl = "flag")} drawdetails.flag & lt; - Function (x, recording = FALSE) {for seq_along (x $ country)) {grid.raster (x $ x [ii], x $ y [ii], width = x $ size [ii] * unit (1, "mm"), hey ght = x $ size [ii] * unit (0.5, "mm"), image = .flaglist [[x $ country [[ii]]]], interpolat = falls)}} Scale_country & lt; - Function (..., Guide = "Legend") {Sc & lt; - discrete_skel ("country", "identity", scales :: identity_pal (), ..., guide = guide) sc $ super & lt; - Scale Discrete Identity Class (SC) & lt; - Square (Scale Discrete Identity) SIC) Geoflag and Lieutenant; - JigroPro ("Geofflag", GOOM, Essential_AS = C ("X", "Y", "Country"), Default_s = AES (size = 5, country = "FR") (Cord & Lieutenant - Corporate $ Transform) Draw_Keys = function (Data, Paramage, Size) {Flaggrabo (0.5,0.5, country = data $ country, size = data $ size)}, draw_group = function (data, panel_celles, corporation) (data, panel_scales) flaggrab (corp $ X, cores $ y, cores $ country, codes $ size)}) geom_flag & lt; - function (mapping = null, data = NULL, stat = "identity", condition = "detection", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...) {layer (geom = GeomFlag, mapping = mapping, data = data, state = state, position = position, show, legend = show, legend, heirs. S = bierceces, params = list (narr = narr, ...)) set.seed ( 1234) D & LT; - data.frame (x = ronmore (10), y = rnorm (10), country = sample (c ("AR", "FR"), 10, TRUE), stringsfactors = FALSE) ggplot (d), Aes Xg = x, y = y, country = country, size = x)) + geom_flag () + scale_country ()  

(from the output ggflags package) / P>


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -