plot - R - upload current ggplot2 to imgur -
The package is actually what I want, but with a scan of the docs it seems that it only uploads files Can I upload the current plot device without outputting the file? Especially I am interested in uploading plots made from ggplot2. Here's what I tried:
& gt; Token = imgur_login ()> Ggplot (dstat, AES (x = obs, y = tcp)) + geom_line () + theme_bw ()> Error in file.exists (file) in file_exam (token = token): Logic "file" is unavailable, without any default
Edit: I should add, I have a method with ease I invisibly creates a file in the background, then uploads it, it is not just the display of plots for the right presentation
Edit: Even the code I have made so far It does not work well because it does not work It seems that the cache used inside account_albums
is not easily disabled.
get_or_create_album = function (token) {# I can not find any way to disable cache inside #account_labs - this is the first time the # results gives. # So if this function creates an album, # user will have to manually log out and log out in # or this function happily album album = account_blocks (id = f, token = token) album = data.frame (T (Sapply (album, c) album = album $ id [album $ title == "r ggplot2"] if (length (album)> = 1) return (album [[1]]) album = create_album (Title = 'r ggplot2', description = 'automatic upload from ggplot2', privacy = 'public', token = token) (Album $ id)} ggupload = function (token) {albumID = get_or_create_album (token) x = tempfile (file text = '.pdf') ggsave (filename = x) p = last_plot () title = "" desc = " Title = Paste (P $ label $ x, "vs", $ $ p $ label) in label (if labeled in "x"% label & amp; "y" in%% label) = Title if (in the "title"% label%) title = p $ label $ title imgur_upload (file = x,
< / Pre>album = albumID, title = title, description = desc, token = token)} This works as follows
& gt; token = imgur_login () & gt; Ggplot (dstat, AES (x = obs, y = tcp)) + geom_line () + theme_bw ()> Ggupload (Token)
Comments
Post a Comment