# Get this figure: fig <- get_figure("jeremiah.feldstein", 72) # Get this figure's data: data <- get_figure("jeremiah.feldstein", 72)$data # Add data to this figure: p <- add_trace(p, x=c(4, 5), y=c(4, 5), kwargs=list(filename="Micro-Bead Sizes In Personal Care Products", fileopt="extend")) # Get y data of first trace: y1 <- get_figure("jeremiah.feldstein", 72)$data[[1]]$y # Get figure documentation: https://plotly.com/r/get-requests/ # Add data documentation: https://plotly.com/r/file-options/ # You can reproduce this figure in R with the following code! # Learn about API authentication here: https://plotly.com/r/getting-started # Find your api_key here: https://plotly.com/settings/api library(plotly) trace1 <- list( uid = "12d6ed", fill = "none", line = list( color = "rgb(0, 67, 88)", width = 1 ), mode = "markers", name = "Garnier Fructis", type = "scatter", x = c(".489", ".479", ".360", ".405", ".511", ".434", ".493", ".420", ".445", ".411", ".475", ".442", ".452", ".382", ".441", ".424", ".427", ".422", ".497", ".423", ".450", ".343", ".446", ".457", ".409", ".470", ".461", ".440"), y = c(".492", ".506", ".388", ".447", ".520", ".427", ".486", ".402", ".430", ".389", ".476", ".423", ".521", ".390", ".426", ".465", ".428", ".410", ".432", ".451", ".438", ".381", ".451", ".453", ".404", ".441", ".492", ".416"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#1f77b4", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(0, 67, 88)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace2 <- list( uid = "8444b7", fill = "none", line = list( color = "rgb(31, 138, 112)", width = 1 ), mode = "markers", name = "Clean & Clear", type = "scatter", x = c(".740", ".733", ".836", ".849", ".839", ".809", ".737", ".803", ".720", ".759", ".930", ".884", ".833", ".909", ".801", ".787", ".766", ".787", ".775", ".762", ".804", ".799", ".815", ".839", ".651", ".785", ".837", ".805"), y = c(".711", ".736", ".924", ".735", ".867", ".796", ".716", ".742", ".780", ".753", ".902", ".888", ".759", ".931", ".717", ".791", ".781", ".726", ".827", ".635", ".819", ".745", ".787", ".784", ".720", ".766", ".832", ".802"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#ff7f0e", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(31, 138, 112)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace3 <- list( uid = "ed8010", fill = "none", line = list( color = "rgb(190, 219, 57)", width = 1 ), mode = "markers", name = "Soft Soap", type = "scatter", x = c(".236", ".378", ".342", ".393", ".343", ".274", ".341", ".336", ".251", ".268", ".387", ".421", ".301", ".321", ".257", ".327", ".231", ".362", ".223", ".398", ".286", ".443", ".258", ".324", ".333", ".359", ".329", ".329", ".319", ".278", ".158", ".244", ".250", ".242", ".316", ".289", ".333", ".264", ".242", ".318"), y = c(".337", ".257", ".491", ".305", ".301", ".274", ".201", ".354", ".448", ".342", ".273", ".334", ".257", ".296", ".330", ".420", ".342", ".312", ".229", ".339", ".296", ".333", ".154", ".280", ".347", ".285", ".301", ".283", ".170", ".407", ".181", ".240", ".263", ".278", ".347", ".420", ".334", ".396", ".274", ".306"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#2ca02c", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(190, 219, 57)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace4 <- list( uid = "1cc738", fill = "none", line = list( color = "rgb(255, 225, 26)", width = 1 ), mode = "markers", name = "Crest", type = "scatter", x = c("", ".217", ".192", ".270", ".912", ".270", ".228", ".137", ".257", ".172", ".179", ".309", ".152", ".089", ".096", ".127", ".116", ".415", ".273", ".112", ".292", ".089", ".047", ".019", ".019", ".013", ".105", ".024", ".090", ".061", ".0047", ".041", ".028", ".206", ".151", ".017", ".011", ".343", ".05", ".215", ".221", ".162", ".108", ".058", ".48", ".012", ".20", ".568", ".171", ".085", ".381", ".19", ".206"), y = c("", ".882", ".487", ".596", ".487", ".596", ".129", ".153", ".184", ".364", ".268", ".125", ".156", ".191", ".062", ".193", ".141", ".214", ".363", ".121", ".261", ".083", ".021", ".022", ".013", ".014", ".087", ".015", ".08", ".096", ".007", ".067", ".016", ".213", ".298", ".017", ".015", ".268", ".16", ".342", ".406", ".275", ".676", ".033", ".16", ".015", ".12", ".204", ".088", ".042", ".234", ".50", ".615"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#d62728", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(255, 225, 26)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace5 <- list( uid = "1db7cd", fill = "none", line = list( color = "rgb(253, 116, 0)", width = 1 ), mode = "markers", name = "Dove", type = "scatter", x = c("", ".165", ".112", ".181", ".131", ".128", ".020", ".08", ".169", ".132", ".057", ".138", ".079", ".191", ".083", ".228", ".035", ".196", ".154", ".067", ".172", ".200", ".063", ".205", ".080", ".072", ".060", ".179", ".114", ".229", ".141", ".076", ".184", ".185", ".140", ".20", ".108", ".062", ".142", ".044", ".056", ".276", ".176", ".168", ".496", ".476", ".753", ".523", ".586", ".566", ".811", ".434", ".796", ".575", ".710", ".545"), y = c("", ".225", ".108", ".201", ".123", ".131", ".020", ".050", ".149", ".207", ".078", ".167", ".079", ".178", ".088", ".240", ".038", ".271", ".146", ".079", ".165", ".260", ".073", ".221", ".080", ".061", ".080", ".167", ".12", ".266", ".131", ".153", ".19", ".18", ".124", ".177", ".119", ".093", ".135", ".045", ".111", ".235", ".143", ".114", ".495", ".49", ".812", ".489", ".594", ".545", ".809", ".43", ".848", ".582", ".754", ".495"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#9467bd", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(253, 116, 0)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace6 <- list( uid = "0d7921", fill = "none", line = list( color = "rgb(166, 28, 0)", width = 1 ), mode = "markers", name = "St. Ives", type = "scatter", x = c("", ".291", ".146", ".210", ".300", ".232", ".289", ".309", ".225", ".256", ".418", ".394", ".309", ".441", ".280", ".295", ".221", ".371", ".289", ".272", ".260", ".300", ".243", ".328", ".508", ".240"), y = c("", ".673", ".297", ".280", ".228", ".293", ".222", ".209", ".426", ".324", ".286", ".191", ".352", ".229", ".265", ".197", ".279", ".251", ".295", ".252", ".644", ".306", ".441", ".310", ".305", ".340"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#8c564b", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(166, 28, 0)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) trace7 <- list( uid = "1225b0", fill = "none", line = list( color = "rgb(0, 67, 88)", width = 1 ), mode = "markers", name = "Neutrogena", type = "scatter", x = c("", ".221", ".161", ".237", ".194", ".319", ".375", ".172", ".138", ".093", ".260", ".225", ".287", ".243", ".280", ".132", ".254", ".223", ".145", ".308", ".152", ".197", ".131", ".165", ".241", ".068", ".097"), y = c("", ".236", ".213", ".308", ".383", ".314", ".359", ".210", ".221", ".110", ".270", ".287", ".202", ".247", ".293", ".202", ".255", ".175", ".278", ".234", ".167", ".267", ".155", ".167", ".254", ".067", ".082"), marker = list( line = list( color = "#444", width = 0 ), size = 6, color = "#e377c2", symbol = "circle", opacity = 1, maxdisplayed = 0 ), error_x = list( visible = FALSE, copy_ystyle = TRUE ), error_y = list( color = "rgb(0, 67, 88)", width = 1, visible = FALSE, thickness = 1 ), opacity = 1 ) data <- list(trace1, trace2, trace3, trace4, trace5, trace6, trace7) layout <- list( font = list( size = 24, color = "#444", family = "Arial, sans-serif" ), title = "Micro-Bead Sizes In Personal Care Products", width = 1379, xaxis = list( type = "linear", dtick = 1, range = c(-0.05426519607843137, 0.9889651960784314), tick0 = 0, ticks = "", title = "Length (mm)", nticks = 0, showgrid = TRUE, showline = FALSE, tickfont = list( size = 24, color = "#444", family = "Arial, sans-serif" ), tickmode = "auto", zeroline = TRUE, autorange = TRUE, gridcolor = "#eee", gridwidth = 1, rangemode = "normal", tickangle = "auto", titlefont = list( size = 24, color = "#444", family = "Arial, sans-serif" ), showexponent = "all", zerolinecolor = "#444", zerolinewidth = 1, exponentformat = "B", showticklabels = TRUE ), yaxis = list( type = "linear", dtick = 1, range = c(-0.052776315789473685, 0.9907763157894738), tick0 = 0, ticks = "", title = "Width (mm)", nticks = 0, showgrid = TRUE, showline = FALSE, tickfont = list( size = 24, color = "#444", family = "Arial, sans-serif" ), tickmode = "auto", zeroline = TRUE, autorange = TRUE, gridcolor = "#eee", gridwidth = 1, rangemode = "normal", tickangle = "auto", titlefont = list( size = 24, color = "#444", family = "Arial, sans-serif" ), showexponent = "all", zerolinecolor = "#444", zerolinewidth = 1, exponentformat = "B", showticklabels = TRUE ), height = 695, legend = list( x = 1.21875, y = 0.966990291262136, font = list( size = 24, color = "#444", family = "Arial, sans-serif" ), bgcolor = "#fff", xanchor = "auto", traceorder = "normal", bordercolor = "#444", borderwidth = 0 ), autosize = TRUE, dragmode = "pan", hovermode = "x", titlefont = list( size = 24, color = "#444", family = "Arial, sans-serif" ), separators = ".,", showlegend = TRUE, hidesources = FALSE, plot_bgcolor = "#fff", paper_bgcolor = "#fff" ) p <- plot_ly() p <- add_trace(p, uid=trace1$uid, fill=trace1$fill, line=trace1$line, mode=trace1$mode, name=trace1$name, type=trace1$type, x=trace1$x, y=trace1$y, marker=trace1$marker, error_x=trace1$error_x, error_y=trace1$error_y, opacity=trace1$opacity) p <- add_trace(p, uid=trace2$uid, fill=trace2$fill, line=trace2$line, mode=trace2$mode, name=trace2$name, type=trace2$type, x=trace2$x, y=trace2$y, marker=trace2$marker, error_x=trace2$error_x, error_y=trace2$error_y, opacity=trace2$opacity) p <- add_trace(p, uid=trace3$uid, fill=trace3$fill, line=trace3$line, mode=trace3$mode, name=trace3$name, type=trace3$type, x=trace3$x, y=trace3$y, marker=trace3$marker, error_x=trace3$error_x, error_y=trace3$error_y, opacity=trace3$opacity) p <- add_trace(p, uid=trace4$uid, fill=trace4$fill, line=trace4$line, mode=trace4$mode, name=trace4$name, type=trace4$type, x=trace4$x, y=trace4$y, marker=trace4$marker, error_x=trace4$error_x, error_y=trace4$error_y, opacity=trace4$opacity) p <- add_trace(p, uid=trace5$uid, fill=trace5$fill, line=trace5$line, mode=trace5$mode, name=trace5$name, type=trace5$type, x=trace5$x, y=trace5$y, marker=trace5$marker, error_x=trace5$error_x, error_y=trace5$error_y, opacity=trace5$opacity) p <- add_trace(p, uid=trace6$uid, fill=trace6$fill, line=trace6$line, mode=trace6$mode, name=trace6$name, type=trace6$type, x=trace6$x, y=trace6$y, marker=trace6$marker, error_x=trace6$error_x, error_y=trace6$error_y, opacity=trace6$opacity) p <- add_trace(p, uid=trace7$uid, fill=trace7$fill, line=trace7$line, mode=trace7$mode, name=trace7$name, type=trace7$type, x=trace7$x, y=trace7$y, marker=trace7$marker, error_x=trace7$error_x, error_y=trace7$error_y, opacity=trace7$opacity) p <- layout(p, font=layout$font, title=layout$title, width=layout$width, xaxis=layout$xaxis, yaxis=layout$yaxis, height=layout$height, legend=layout$legend, autosize=layout$autosize, dragmode=layout$dragmode, hovermode=layout$hovermode, titlefont=layout$titlefont, separators=layout$separators, showlegend=layout$showlegend, hidesources=layout$hidesources, plot_bgcolor=layout$plot_bgcolor, paper_bgcolor=layout$paper_bgcolor)