# Get this figure: fig <- get_figure("cbrandon", 7) # Get this figure's data: data <- get_figure("cbrandon", 7)$data # Add data to this figure: p <- add_trace(p, x=c(4, 5), y=c(4, 5), kwargs=list(filename="Vermont Lunar CubeSat orbit", fileopt="extend")) # Get y data of first trace: y1 <- get_figure("cbrandon", 7)$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( line = lis), name = "Inclination", type = "scatter", x = c(108.0, 114.0, 241.0, 299.0, 308.0, 409.0, 432.0, 462.0, 777.0, 869.0, 922.0, 923.0, 920.0, 920.0, 920.0, 1087.0, 1087.0, 1166.0, 1233.0, 1233.0, 1497.0, 1562.0, 1661.0, 1775.0, 1963.0, 1963.0, 2091.0, 2235.0, 2370.0, 2415.0, 2417.0, 2578.0, 2795.0, 2963.0, 3153.0, 3322.0, 3555.0, 3714.0, 3903.0, 4079.0, 4318.0, 4630.0, 4812.0), y = c(40.5172, 40.5114, 40.519400000000005, 40.5174, 40.5189, 40.519800000000004, 40.5186, 40.518100000000004, 40.519600000000004, 40.5187, 40.5199, 40.5182, 40.516600000000004, 40.516600000000004, 40.516600000000004, 40.5206, 40.5206, 40.519000000000005, 40.5197, 40.5197, 40.5165, 40.5163, 40.514500000000005, 40.519000000000005, 40.517, 40.517, 40.5105, 40.5075, 40.5142, 40.507400000000004, 40.506800000000005, 40.516600000000004, 40.5161, 40.5159, 40.5159, 40.5158, 40.5165, 40.5168, 40.5169, 40.5173, 40.517500000000005, 40.518, 40.5186), xbins = lis), yaxis = "y2", marker = list(line = lis)), error_y = lis), textfont = lis) ) trace2 <- list( line = lis), name = "Eccentr.", type = "scatter", x = c(108.0, 114.0, 241.0, 299.0, 308.0, 409.0, 432.0, 462.0, 777.0, 869.0, 922.0, 923.0, 920.0, 920.0, 920.0, 1087.0, 1087.0, 1166.0, 1233.0, 1233.0, 1497.0, 1562.0, 1661.0, 1775.0, 1963.0, 1963.0, 2091.0, 2235.0, 2370.0, 2415.0, 2417.0, 2578.0, 2795.0, 2963.0, 3153.0, 3322.0, 3555.0, 3714.0, 3903.0, 4079.0, 4318.0, 4630.0, 4812.0), y = c(6035.0, 5162.0, 5877.0, 6397.0, 6112.0, 6051.0, 6195.0, 6073.0, 6056.0, 5349.0, 5267.0, 5612.0, 5323.0, 5323.0, 5323.0, 5237.0, 5237.0, 5517.0, 4593.0, 4593.0, 5226.0, 4327.0, 3506.0, 4833.0, 4527.0, 4527.0, 2598.0, 2462.0, 3438.0, 2817.0, 2487.0, 3644.0, 3218.0, 3007.0, 2934.0, 2985.0, 2967.0, 3004.0, 3037.0, 3130.0, 3366.0, 3707.0, 3924.0), xbins = lis), marker = list(line = lis)), error_y = lis), textfont = lis) ) trace3 <- list( line = lis), name = "M Motion", type = "scatter", x = c(108.0, 114.0, 241.0, 299.0, 308.0, 409.0, 432.0, 462.0, 777.0, 869.0, 922.0, 923.0, 920.0, 920.0, 920.0, 1087.0, 1087.0, 1166.0, 1233.0, 1233.0, 1497.0, 1562.0, 1661.0, 1775.0, 1963.0, 1963.0, 2091.0, 2235.0, 2370.0, 2415.0, 2417.0, 2578.0, 2795.0, 2963.0, 3153.0, 3322.0, 3555.0, 3714.0, 3903.0, 4079.0, 4318.0, 4630.0, 4812.0), y = c(15.21012737, 15.21036615, 15.21109505, 15.21097009, 15.21113058, 15.21127139, 15.21133141, 15.211344760000001, 15.211971870000001, 15.21212188, 15.2121475, 15.21221282, 15.21217141, 15.21217141, 15.21217141, 15.21236756, 15.21236756, 15.21248494, 15.21248898, 15.21248898, 15.21270573, 15.21279416, 15.212773160000001, 15.21316468, 15.21319895, 15.21319895, 15.21346638, 15.21355108, 15.21366688, 15.21388864, 15.213884890000001, 15.20964887, 15.20980078, 15.209936560000001, 15.21012142, 15.21027329, 15.210460020000001, 15.210612900000001, 15.21081767, 15.211006040000001, 15.21123837, 15.2115199, 15.21167118), xbins = lis), yaxis = "y3", marker = list(line = lis)), error_y = lis), textfont = lis) ) data <- list(trace1, trace2, trace3) layout <- list( font = list( size = 12, color = "#000", family = "'Open sans', verdana, arial, sans-serif" ), title = "Vermont Lunar CubeSat", width = 1344, xaxis = list( type = "linear", dtick = 500, range = c(108, 4812), tick0 = 0, ticks = "outside", title = "Revolutions since November 19, 2013, 8:15pm EST Launch", anchor = "y", domain = c(0.1, 1), mirror = "all", nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = TRUE, tickfont = list( size = 0, color = "rgb(0, 0, 255)", family = "" ), zeroline = TRUE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "#000", tickwidth = 1, titlefont = list( size = 0, color = "rgb(0, 0, 255)", family = "" ), overlaying = FALSE, showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), yaxis = list( type = "linear", dtick = 500, range = c(2243.3888888888887, 6615.611111111111), tick0 = 0, ticks = "outside", title = "Eccentricity x 10^-7", anchor = "x", domain = c(0, 1), mirror = "all", nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = TRUE, tickfont = list( size = 0, color = "rgb(255, 127, 14)", family = "" ), zeroline = TRUE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "#000", tickwidth = 1, titlefont = list( size = 0, color = "rgb(255, 127, 14)", family = "" ), overlaying = FALSE, showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), bargap = 0.2, boxgap = 0.3, height = 565, legend = list( x = 0.98, y = 0.98, font = list( size = 0, color = "", family = "" ), bgcolor = "#fff", traceorder = "normal", bordercolor = "#000", borderwidth = 1 ), margin = list( b = 80, l = 80, r = 80, t = 100, pad = 2 ), yaxis2 = list( side = "right", type = "linear", dtick = 0.002, range = c(40.50603333333334, 40.521366666666665), tick0 = 0, ticks = "outside", title = "Inclination (degrees)", anchor = "x", domain = c(0, 1), mirror = "all", nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = TRUE, tickfont = list( size = 0, color = "rgb(31, 119, 180)", family = "" ), zeroline = TRUE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "#000", tickwidth = 1, titlefont = list( size = 0, color = "rgb(31, 119, 180)", family = "" ), overlaying = "y", showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), yaxis3 = list( side = "left", type = "linear", dtick = 0.0005, range = c(15.209413327222222, 15.214124182777779), tick0 = 0, ticks = "outside", title = "Mean Montion (revolutions/day)", anchor = "free", domain = c(0, 1), mirror = "all", nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = TRUE, tickfont = list( size = 0, color = "rgb(44, 160, 44)", family = "" ), zeroline = TRUE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "#000", tickwidth = 1, titlefont = list( size = 0, color = "rgb(44, 160, 44)", family = "" ), overlaying = "y", showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), barmode = "stack", boxmode = "overlay", autosize = TRUE, dragmode = "zoom", hovermode = "x", titlefont = list( size = 0, color = "rgb(0, 0, 255)", family = "" ), separators = ".,", showlegend = TRUE, bargroupgap = 0, boxgroupgap = 0.3, plot_bgcolor = "#fff", paper_bgcolor = "#fff" ) p <- plot_ly() p <- add_trace(p, line=trace1$line, name=trace1$name, type=trace1$type, x=trace1$x, y=trace1$y, xbins=trace1$xbins, yaxis=trace1$yaxis, marker=trace1$marker, error_y=trace1$error_y, textfont=trace1$textfont) p <- add_trace(p, line=trace2$line, name=trace2$name, type=trace2$type, x=trace2$x, y=trace2$y, xbins=trace2$xbins, marker=trace2$marker, error_y=trace2$error_y, textfont=trace2$textfont) p <- add_trace(p, line=trace3$line, name=trace3$name, type=trace3$type, x=trace3$x, y=trace3$y, xbins=trace3$xbins, yaxis=trace3$yaxis, marker=trace3$marker, error_y=trace3$error_y, textfont=trace3$textfont) p <- layout(p, font=layout$font, title=layout$title, width=layout$width, xaxis=layout$xaxis, yaxis=layout$yaxis, bargap=layout$bargap, boxgap=layout$boxgap, height=layout$height, legend=layout$legend, margin=layout$margin, yaxis2=layout$yaxis2, yaxis3=layout$yaxis3, barmode=layout$barmode, boxmode=layout$boxmode, autosize=layout$autosize, dragmode=layout$dragmode, hovermode=layout$hovermode, titlefont=layout$titlefont, separators=layout$separators, showlegend=layout$showlegend, bargroupgap=layout$bargroupgap, boxgroupgap=layout$boxgroupgap, plot_bgcolor=layout$plot_bgcolor, paper_bgcolor=layout$paper_bgcolor)