# Get this figure: fig <- get_figure("Jackson", 7) # Get this figure's data: data <- get_figure("Jackson", 7)$data # Add data to this figure: p <- add_trace(p, x=c(4, 5), y=c(4, 5), kwargs=list(filename="The Cost of Healthy Eating", fileopt="extend")) # Get y data of first trace: y1 <- get_figure("Jackson", 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( uid = "6a0761", line = list( color = "rgb(227, 50, 0)", width = 3 ), name = "Sodas", type = "scatter", x = c("1978-3-31", "1978-9-8", "1979-1-18", "1979-5-13", "1979-9-30", "1980-2-16", "1980-6-2", "1980-9-7", "1981-2-7", "1981-6-14", "1981-10-19", "1982-3-21", "1982-8-21", "1983-1-20", "1983-6-22", "1983-11-22", "1984-4-22", "1984-9-22", "1985-2-22", "1985-7-24", "1985-12-11", "1986-5-26", "1986-11-7", "1987-1-22", "1987-6-11", "1987-11-11", "1988-4-12", "1988-9-11", "1989-2-11", "1989-7-14", "1989-12-13", "1990-5-15", "1990-10-15", "1991-3-16", "1991-8-16", "1992-1-16", "1992-6-16", "1992-11-16", "1993-4-18", "1993-9-17", "1994-2-17", "1994-7-20", "1994-12-19", "1995-5-21", "1995-10-21", "1996-3-21", "1996-8-21", "1996-12-26", "1997-5-2", "1997-10-2", "1998-3-4", "1998-8-3", "1999-1-3", "1999-6-5", "1999-11-4", "2000-4-5", "2000-9-5", "2001-2-4", "2001-7-13", "2001-12-7", "2002-4-13", "2002-8-18", "2003-1-18", "2003-6-20", "2003-11-19", "2004-4-20", "2004-9-20", "2005-2-19", "2005-7-22", "2005-12-22", "2006-5-23", "2006-10-23", "2007-3-25", "2007-8-24", "2008-1-29", "2008-5-25", "2008-8-19", "2008-10-9", "2008-9-22", "2009-1-14"), y = c(1.0095628415300546, 1.0079234972677595, 1.007158469945355, 0.9899058894960535, 0.9778005464480874, 0.9617486338797814, 0.9714936247723133, 0.988615664845173, 0.9897540983606558, 0.975068306010929, 0.9562082574377655, 0.9487704918032788, 0.932832422586521, 0.9396630236794172, 0.9312386156648452, 0.9269125683060109, 0.9143897996357013, 0.901183970856102, 0.8932149362477232, 0.8858530661809351, 0.8776867030965394, 0.8785291438979965, 0.8766734972677597, 0.8726092896174864, 0.8625910746812386, 0.8438069216757741, 0.8372040072859745, 0.8226320582877962, 0.8123861566484518, 0.8135245901639345, 0.8095780206435943, 0.7984972677595628, 0.7887067395264116, 0.7764116575591984, 0.7634335154826957, 0.7629781420765027, 0.7618397085610201, 0.7511384335154826, 0.7433970856102006, 0.7405510018214936, 0.7331511839708562, 0.7206284153005463, 0.7235883424408015, 0.7288251366120219, 0.7274590163934427, 0.7160746812386157, 0.7078779599271403, 0.6963797814207651, 0.6838190649666058, 0.6810109289617485, 0.6736490588949605, 0.6682604735883426, 0.6637067395264115, 0.6638964784456586, 0.6623406193078324, 0.6690194292653309, 0.6608227079538556, 0.6575591985428049, 0.6543715846994536, 0.6614298724954464, 0.6547131147540982, 0.6418488160291439, 0.6395719489981786, 0.6320582877959929, 0.6320582877959928, 0.6325136612021858, 0.6240892531876138, 0.624544626593807, 0.625, 0.6240892531876137, 0.6153612629022465, 0.6208257437765635, 0.6286429872495447, 0.6293260473588345, 0.62256049960968, 0.6248113453031485, 0.6174863387978141, 0.6543715846994534, 0.633879781420765, 0.6734972677595629), marker = list(line = lis)), error_x = lis), error_y = lis), textfont = lis) ) trace2 <- list( uid = "a9eb53", line = list( color = "rgb(255, 147, 17)", width = 3 ), name = "Butter", type = "scatter", x = c("1978-3-9", "1978-6-13", "1978-10-18", "1978-8-18", "1978-12-16", "1979-5-13", "1979-9-30", "1980-1-9", "1980-4-7", "1980-7-14", "1980-9-27", "1981-2-1", "1981-6-1", "1981-7-9", "1981-11-14", "1982-4-3", "1982-7-26", "1982-12-26", "1983-4-19", "1983-5-27", "1983-10-27", "1984-3-28", "1984-7-27", "1984-10-30", "1985-1-27", "1985-4-13", "1985-9-13", "1985-8-31", "1986-2-13", "1986-7-17", "1986-10-25", "1986-10-25", "1987-3-27", "1987-8-24", "1988-1-26", "1988-6-27", "1988-11-27", "1989-4-28", "1989-9-28", "1990-2-28", "1990-7-30", "1990-12-30", "1991-6-1", "1991-10-31", "1992-4-1", "1992-9-1", "1993-1-31", "1993-7-3", "1993-12-3", "1994-5-4", "1994-10-4", "1995-3-3", "1995-8-5", "1996-1-5", "1996-6-6", "1996-11-5", "1997-4-7", "1997-9-7", "1998-2-6", "1998-7-9", "1998-11-30", "1999-1-24", "1999-2-23", "1999-2-23", "1999-6-15", "1999-4-21", "1999-5-10", "1999-9-27", "1999-11-17", "1999-11-17", "1999-12-19", "2000-3-13", "2000-2-1", "2000-8-5", "2000-9-5", "2000-10-30", "2001-2-17", "2001-1-23", "2000-12-3", "2001-4-22", "2001-4-9", "2001-5-17", "2001-7-20", "2001-5-30", "2001-5-30", "2001-8-27", "2001-11-16", "2002-1-1", "2001-12-28", "2002-3-6", "2002-3-6", "2002-5-8", "2002-4-26", "2002-5-21", "2002-6-28", "2002-8-16", "2002-12-23", "2003-4-23", "2003-8-14", "2003-9-29", "2003-12-15", "2004-2-16", "2004-2-29", "2004-3-13", "2004-2-16", "2004-2-16", "2004-2-16", "2004-5-26", "2004-4-7", "2004-3-21", "2004-4-7", "2004-5-28", "2004-7-14", "2004-8-12", "2004-11-4", "2004-9-7", "2005-2-15", "2005-3-24", "2005-5-13", "2005-7-20", "2005-12-13", "2006-3-5", "2006-4-30", "2006-7-13", "2006-8-8", "2006-12-13", "2007-5-24", "2007-3-25", "2007-9-11", "2008-1-26", "2008-3-17", "2008-6-25", "2008-10-20", "2008-12-20", "2008-12-7", "2009-2-16", "2009-3-6", "2009-4-13"), y = c(1.0075136612021858, 1.0193989071038252, 1.0356898907103824, 1.019808743169399, 1.0515222482435598, 1.0387067395264116, 1.0364298724954462, 1.0226775956284153, 1.0127504553734061, 1.0218579234972678, 1.0444964871194378, 1.0238095238095237, 1.010928961748634, 0.9959016393442623, 0.9820127504553734, 0.9765027322404372, 0.961976320582878, 0.9601548269581057, 0.9567395264116576, 0.9405737704918034, 0.9365892531876137, 0.9239526411657559, 0.9299863387978142, 0.9426229508196722, 0.9310109289617486, 0.9120673952641165, 0.9018670309653916, 0.8890710382513661, 0.8907103825136611, 0.8881082487639866, 0.9043715846994536, 0.8825136612021858, 0.9023982999392836, 0.9002732240437159, 0.8998178506375227, 0.8950364298724953, 0.8907103825136613, 0.8841074681238617, 0.8834244080145719, 0.8784304796599879, 0.8699149969641773, 0.8617941712204009, 0.8617941712204008, 0.863615664845173, 0.8713570127504555, 0.8715846994535519, 0.871584699453552, 0.8731785063752278, 0.8790983606557378, 0.8811475409836065, 0.8822859744990893, 0.8851548269581054, 0.8891165755919855, 0.8904826958105647, 0.889344262295082, 0.8898755312689739, 0.899817850637523, 0.9068761384335156, 0.9153005464480874, 0.9219034608378871, 0.9234972677595628, 0.8975409836065573, 0.866120218579235, 0.8510928961748634, 0.8311475409836064, 0.8121584699453552, 0.7991803278688524, 0.8160291438979963, 0.773224043715847, 0.7950819672131147, 0.7558060109289617, 0.7325136612021859, 0.7062841530054644, 0.7512295081967214, 0.7397540983606556, 0.7673041894353371, 0.8464936247723134, 0.8249089253187613, 0.799863387978142, 0.887295081967213, 0.8729508196721311, 0.8497267759562841, 0.959016393442623, 0.9412568306010929, 0.9193989071038251, 0.9799635701275047, 0.9517304189435337, 0.9207650273224044, 0.9030054644808743, 0.8938979963570128, 0.8722677595628414, 0.8440346083788707, 0.8633879781420766, 0.8306010928961749, 0.8107923497267759, 0.7808743169398906, 0.7581967213114755, 0.7390368852459015, 0.7358834244080146, 0.7575136612021858, 0.7756147540983606, 0.8592896174863388, 0.8879781420765027, 0.8756830601092895, 0.8292349726775955, 0.8128415300546448, 0.7909836065573771, 1.0032786885245901, 0.9491803278688524, 0.9212204007285976, 0.912568306010929, 1.0277777777777781, 0.9792805100182149, 0.9986338797814207, 0.9607728337236534, 0.8715846994535519, 0.9422586520947177, 0.9169398907103825, 0.8913934426229507, 0.8776346604215457, 0.8672586520947176, 0.8333333333333335, 0.8112021857923497, 0.7839253187613844, 0.7701502732240436, 0.7877959927140255, 0.782635094110504, 0.7677595628415301, 0.785245901639344, 0.771584699453552, 0.7568306010928962, 0.7798269581056466, 0.8075288403157255, 0.7889344262295082, 0.8169398907103825, 0.7599453551912569, 0.7424863387978142, 0.7181238615664847), marker = list(line = lis)), error_x = lis), error_y = lis), textfont = lis) ) trace3 <- list( uid = "41bf24", line = list( color = "rgb(250, 208, 101)", width = 3 ), name = "Beer", type = "scatter", x = c("1978-4-26", "1978-10-8", "1979-1-5", "1979-7-28", "1979-12-28", "1980-4-20", "1980-8-23", "1980-12-9", "1981-3-30", "1981-7-31", "1981-10-6", "1982-1-4", "1982-5-31", "1982-7-26", "1982-12-19", "1982-12-13", "1983-6-2", "1983-10-27", "1984-4-7", "1984-8-15", "1985-1-27", "1985-6-29", "1985-11-28", "1986-4-30", "1986-9-30", "1987-3-1", "1987-8-1", "1988-1-1", "1988-6-1", "1988-11-1", "1989-4-3", "1989-9-2", "1990-2-2", "1990-6-22", "1990-9-28", "1990-12-22", "1990-12-17", "1991-2-12", "1990-12-17", "1991-7-21", "1991-12-19", "1992-5-22", "1992-10-21", "1993-2-26", "1993-7-3", "1993-12-3", "1994-5-4", "1994-10-4", "1995-3-6", "1995-8-5", "1996-1-5", "1996-6-6", "1996-11-5", "1997-4-7", "1997-9-7", "1998-2-6", "1998-7-9", "1998-12-9", "1999-5-10", "1999-5-23", "1999-10-10", "2000-3-11", "2000-8-10", "2001-1-10", "2001-4-9", "2001-8-27", "2002-2-5", "2002-6-19", "2002-11-28", "2003-4-30", "2003-9-29", "2004-3-6", "2004-7-31", "2004-12-30", "2005-6-1", "2005-11-1", "2006-4-2", "2006-9-2", "2007-2-2", "2007-7-4", "2007-12-4", "2008-5-5", "2008-9-22", "2008-10-22", "2009-1-8"), y = c(0.994535519125683, 0.9924863387978142, 0.9993169398907105, 0.985655737704918, 0.9837773224043715, 0.9824681238615665, 0.9628688524590165, 0.9576502732240436, 0.9403460837887068, 0.9250758955676989, 0.9439890710382514, 0.9225865209471769, 0.9190085870413738, 0.9109744990892532, 0.9212204007285976, 0.9043715846994536, 0.94324391455539, 0.9440649666059504, 0.9330601092896175, 0.9310868245294475, 0.9285063752276866, 0.9244080145719489, 0.9225865209471767, 0.9289617486338797, 0.927367941712204, 0.9150728597449911, 0.9071038251366121, 0.9057832422586521, 0.9025956284153005, 0.8961748633879782, 0.8889647844565877, 0.8895719489981786, 0.8900273224043717, 0.885792349726776, 0.872495446265938, 0.9068306010928961, 0.8875227686703097, 0.949282786885246, 0.9275956284153005, 0.9508196721311476, 0.950624512099922, 0.9592440801457195, 0.9453551912568308, 0.9337431693989071, 0.920992714025501, 0.9164389799635702, 0.9089253187613844, 0.8952641165755921, 0.8860048573163329, 0.8813752276867031, 0.877959927140255, 0.8811475409836065, 0.8752276867030964, 0.8683970856102002, 0.8583788706739528, 0.8497267759562841, 0.8497267759562841, 0.8501821493624774, 0.850182149362477, 0.8265027322404371, 0.8497267759562841, 0.8497267759562841, 0.8479052823315119, 0.8456284153005464, 0.841188524590164, 0.8497267759562841, 0.8549960967993755, 0.8567525370804059, 0.8520036429872495, 0.8497267759562841, 0.8572404371584699, 0.8621926229508197, 0.8627049180327868, 0.8586065573770492, 0.8460837887067396, 0.831511839708561, 0.8278688524590164, 0.8237704918032789, 0.8253642987249544, 0.8337887067395264, 0.8244535519125682, 0.8162568306010929, 0.8148907103825135, 0.8385245901639344, 0.8608265027322403), marker = list(line = lis)), error_x = lis), error_y = lis), textfont = lis) ) trace4 <- list( uid = "789ccf", line = list( color = "rgba(23, 96, 125, 0.45)", width = 3 ), name = "Fresh vegetables", type = "scatter", x = c("1978-3-6", "1978-5-20", "1978-5-9", "1978-5-21", "1978-3-19", "1978-3-19", "1978-4-26", "1978-4-26", "1978-9-13", "1978-12-3", "1979-1-18", "1979-1-31", "1979-3-1", "1979-5-6", "1979-4-30", "1979-5-25", "1979-4-21", "1979-4-4", "1979-10-4", "1979-8-22", "1979-10-12", "1979-12-2", "1980-2-10", "1980-1-16", "1980-2-24", "1980-2-4", "1980-2-4", "1980-1-18", "1980-4-7", "1980-2-16", "1980-5-16", "1980-7-5", "1980-9-7", "1980-9-20", "1980-11-10", "1981-1-30", "1981-2-19", "1981-2-19", "1981-2-19", "1981-3-25", "1981-7-22", "1981-10-26", "1981-9-11", "1981-12-22", "1982-1-4", "1981-12-22", "1982-1-4", "1982-1-8", "1982-1-4", "1982-2-21", "1982-5-23", "1982-4-28", "1982-7-26", "1982-10-15", "1982-10-16", "1982-9-15", "1982-9-28", "1983-2-17", "1983-1-20", "1983-1-20", "1983-1-20", "1983-2-2", "1983-5-2", "1983-5-8", "1983-6-9", "1983-9-25", "1983-9-6", "1983-7-30", "1983-10-25", "1983-10-14", "1983-8-24", "1984-1-24", "1984-1-24", "1984-2-10", "1984-2-6", "1984-5-13", "1984-3-15", "1984-4-24", "1984-5-24", "1984-5-5", "1984-7-14", "1984-8-27", "1984-8-2", "1984-10-17", "1984-11-24", "1984-11-24", "1984-12-7", "1984-11-24", "1985-2-9", "1984-12-20", "1985-3-19", "1985-3-19", "1985-5-25", "1985-8-6", "1985-12-11", "1985-12-8", "1986-1-6", "1986-1-31", "1986-2-25", "1986-5-26", "1986-5-9", "1986-6-7", "1986-9-17", "1986-11-7", "1986-12-11", "1986-12-28", "1987-2-4", "1987-5-24", "1987-6-11", "1987-9-18", "1987-9-3", "1987-12-3", "1987-12-6", "1987-12-6", "1987-12-6", "1987-10-29", "1987-12-6", "1988-1-17", "1988-3-4", "1988-5-7", "1988-6-14", "1988-4-24", "1988-5-7", "1988-10-12", "1988-9-24", "1989-1-29", "1989-1-4", "1989-3-21", "1989-6-18", "1989-8-12", "1989-10-23", "1989-10-23", "1989-10-23", "1989-10-31", "1990-1-20", "1989-12-30", "1990-1-31", "1990-2-2", "1989-12-1", "1989-12-1", "1990-1-20", "1990-1-20", "1990-1-20", "1990-3-4", "1990-1-29", "1990-3-4", "1990-4-19", "1990-5-2", "1990-7-5", "1990-7-30", "1990-10-2", "1990-9-19", "1990-10-2", "1990-11-22", "1990-12-13", "1990-11-22", "1991-3-4", "1991-5-6", "1991-5-14", "1991-3-29", "1991-5-19", "1991-6-1", "1991-5-19", "1991-7-21", "1991-7-19", "1991-10-19", "1991-10-12", "1991-12-3", "1992-1-28", "1992-3-6", "1992-3-6", "1992-2-23", "1992-2-23", "1992-3-19", "1992-4-14", "1992-6-29", "1992-6-16", "1992-6-4", "1992-9-26", "1993-3-15", "1993-2-23", "1993-2-26", "1993-4-5", "1993-6-20", "1993-4-30", "1993-5-13", "1993-7-28", "1993-6-20", "1993-7-28", "1993-7-3", "1993-6-29", "1993-11-25", "1993-12-15", "1994-2-4", "1994-3-14", "1994-3-7", "1994-3-27", "1994-7-7", "1994-8-27", "1994-12-11", "1994-11-11", "1994-12-23", "1994-10-17", "1994-12-19", "1995-2-4", "1995-2-4", "1995-3-23", "1995-4-13", "1995-4-25", "1995-2-21", "1995-5-8", "1995-5-21", "1995-7-24", "1995-8-18", "1995-8-31", "1995-9-16", "1995-12-12", "1996-3-26", "1996-3-21", "1996-3-21", "1996-3-9", "1996-7-14", "1996-9-15", "1996-12-1", "1997-1-21", "1997-2-25", "1997-2-15", "1997-5-28", "1997-9-7", "1998-1-17", "1997-11-9", "1998-1-30", "1998-1-3", "1998-3-29", "1998-4-24", "1998-5-19", "1998-9-5", "1998-8-29", "1998-12-9", "1999-2-10", "1999-4-13", "1999-9-20", "2000-2-14", "2000-2-1", "2000-6-15", "2000-11-21", "2001-1-10", "2000-12-28", "2001-1-23", "2001-6-12", "2001-10-25", "2001-11-24", "2002-3-19", "2002-3-19", "2002-3-6", "2002-3-6", "2002-6-18", "2002-6-28", "2002-10-28", "2003-2-25", "2003-5-25", "2003-7-31", "2003-10-12", "2003-12-27", "2004-2-29", "2004-6-14", "2004-11-13", "2004-12-5", "2004-12-13", "2004-12-18", "2004-11-22", "2005-1-18", "2005-2-6", "2005-3-14", "2005-2-19", "2005-4-30", "2005-4-11", "2005-5-19", "2005-10-26", "2006-1-29", "2006-4-2", "2006-4-2", "2006-6-24", "2006-8-31", "2006-9-27", "2006-11-15", "2006-9-27", "2006-11-17", "2006-12-20", "2007-3-25", "2007-5-2", "2007-7-30", "2007-7-17", "2007-12-29", "2008-2-18", "2008-4-22", "2008-5-17", "2008-8-30", "2008-8-27", "2008-12-2", "2009-2-9", "2009-1-27", "2009-5-9"), y = c(1.0416666666666665, 1.144808743169399, 1.123292349726776, 1.1079234972677594, 1.0915300546448088, 1.075136612021858, 1.0560109289617485, 1.1598360655737705, 1.1111111111111112, 1.0866120218579236, 1.07103825136612, 0.9781420765027322, 1.022313296903461, 1.0563524590163933, 0.9519125683060108, 0.9401639344262296, 0.9203096539162113, 0.9098360655737705, 1.003825136612022, 0.9678961748633881, 0.9487704918032788, 0.930327868852459, 0.903620218579235, 0.8814890710382514, 0.8603825136612021, 0.8438069216757741, 0.8274134790528234, 0.8082877959927142, 0.9993169398907105, 0.9781420765027322, 0.9271402550091075, 0.9499089253187614, 1.0022768670309654, 1.0596539162112932, 0.982695810564663, 1.005327868852459, 1.0589383294301329, 1.1007513661202186, 1.080601092896175, 1.0382513661202186, 1.022768670309654, 1.0062234365513054, 0.9453551912568305, 0.9706284153005464, 1.0771857923497268, 1.0569216757741347, 1.042691256830601, 1.0277777777777777, 1.1024590163934427, 1.010928961748634, 0.9890710382513661, 1.0218579234972678, 0.8959471766848817, 0.8768214936247724, 0.8534525583705912, 0.9740437158469946, 0.9508196721311475, 0.906120218579235, 0.8688524590163935, 0.8524590163934427, 0.8309426229508197, 0.9193989071038251, 0.9957650273224044, 0.9716840536512668, 0.9048269581056467, 1.0158811475409837, 0.9993169398907105, 0.9836065573770492, 1.0557767369242779, 1.0336065573770492, 0.9562841530054644, 1.1024590163934427, 1.0842440801457194, 1.1434426229508197, 1.1229508196721312, 1.0673952641165756, 1.046903460837887, 1.0024590163934426, 1.028688524590164, 0.95856102003643, 0.9781420765027322, 1.0621584699453552, 1.0464480874316942, 1.0058060109289617, 0.9881602914389801, 0.9716150576806314, 1.0389344262295082, 0.9234972677595629, 0.9576502732240437, 1.0683060109289617, 0.996584699453552, 0.9767759562841529, 0.9416471506635442, 1.0102459016393444, 0.9839480874316939, 0.9558938329430133, 0.9360200364298725, 0.9063752276867032, 0.8674863387978142, 0.9948770491803278, 0.961976320582878, 0.9767759562841529, 1.0140027322404372, 0.9978749241044322, 0.9726775956284153, 0.9617486338797814, 1.0112704918032787, 1.044535519125683, 1.0589708561020035, 1.06775956284153, 1.0382513661202184, 1.1350751366120218, 1.0816256830601094, 1.1846539162112932, 1.162226775956284, 1.1557377049180326, 1.2076502732240437, 1.1118266978922717, 1.0689890710382515, 1.1263661202185793, 1.048554189435337, 1.099726775956284, 1.0307377049180328, 1.0678092399403876, 1.0464480874316942, 1.104280510018215, 1.0744535519125684, 1.1202185792349728, 1.1377504553734061, 1.1762295081967213, 1.2087887067395264, 1.14867941712204, 1.1325136612021858, 1.078688524590164, 1.2390710382513663, 1.2864298724954462, 1.2678142076502734, 1.1782786885245902, 1.1188524590163933, 1.1024590163934427, 1.3401639344262295, 1.3237704918032787, 1.3073770491803278, 1.227686703096539, 1.2035519125683058, 1.150728597449909, 1.0744535519125684, 1.2704918032786885, 1.2448770491803278, 1.0981329690346084, 1.2192622950819674, 1.2042349726775956, 1.1229508196721312, 1.1051912568306013, 1.068032786885246, 1.0915300546448088, 1.1212431693989071, 1.206511839708561, 1.1586338797814206, 1.1382513661202187, 1.2340619307832423, 1.1779371584699454, 1.25, 1.3155737704918034, 1.0947540983606556, 1.0816256830601094, 1.0525335320417288, 1.0346994535519127, 1.001912568306011, 1.0966530054644807, 1.075136612021858, 1.0591985428051003, 1.1489071038251368, 1.1270491803278688, 1.1147540983606559, 1.093351548269581, 1.07172131147541, 1.057377049180328, 1.1327413479052821, 1.2431693989071038, 1.2185792349726776, 1.131451123254402, 1.2868852459016396, 1.1976775956284151, 1.1625683060109289, 1.17896174863388, 1.249544626593807, 1.22632058287796, 1.1427595628415301, 1.1277322404371586, 1.1065573770491803, 1.144535519125683, 1.1707650273224044, 1.1165755919854279, 1.0935792349726774, 1.0590163934426229, 1.081056466302368, 1.1461748633879782, 1.157103825136612, 1.3016848816029145, 1.3350409836065573, 1.263785394932936, 1.1871584699453552, 1.3609972677595628, 1.3752276867030964, 1.238615664845173, 1.3040437158469946, 1.2833333333333332, 1.2308743169398908, 1.209016393442623, 1.2700364298724955, 1.349726775956284, 1.242440801457195, 1.2208561020036428, 1.2042349726775956, 1.1869633099141295, 1.177985948477752, 1.197480267152398, 1.2438524590163933, 1.2267759562841531, 1.2172131147540985, 1.1935336976320583, 1.165072859744991, 1.1268214936247722, 1.150728597449909, 1.1664959016393444, 1.1892076502732243, 1.165983606557377, 1.2168715846994536, 1.3101092896174866, 1.248633879781421, 1.2942622950819673, 1.2748178506375227, 1.339412568306011, 1.368624772313297, 1.3135245901639347, 1.2803582270795386, 1.3005464480874318, 1.2718579234972678, 1.24802671523983, 1.2241087691907366, 1.240191256830601, 1.2222222222222223, 1.2049180327868854, 1.2568306010928962, 1.2665176353700947, 1.290528233151184, 1.3255919854280513, 1.307377049180328, 1.2759562841530057, 1.2818761384335156, 1.312841530054645, 1.4162112932604736, 1.4004781420765027, 1.3857012750455375, 1.364071038251366, 1.3302823315118397, 1.4337431693989071, 1.3062593144560357, 1.3016848816029147, 1.3360655737704918, 1.3604605776736927, 1.4453551912568305, 1.3461748633879784, 1.3287795992714027, 1.3180024286581666, 1.3811475409836067, 1.350204918032787, 1.4428506375227688, 1.419672131147541, 1.4039162112932606, 1.3309426229508197, 1.3029371584699454, 1.3748633879781424, 1.353825136612022, 1.3978825136612023, 1.4439890710382517, 1.4125683060109293, 1.3663153786104607, 1.3870673952641166, 1.3678278688524592, 1.3565573770491803, 1.4340846994535519, 1.460187353629977, 1.4077868852459017, 1.3882513661202185, 1.4398907103825138, 1.4262295081967213, 1.360655737704918, 1.4157559198542806, 1.5136612021857925, 1.3811475409836067, 1.3647540983606556, 1.3818306010928962, 1.3654371584699456, 1.3843351548269585, 1.4043715846994536, 1.4444858420268258, 1.4620218579234974, 1.4390710382513663, 1.4064207650273226, 1.459016393442623, 1.4098360655737707), marker = list(line = lis)), error_x = lis), error_y = lis), textfont = lis) ) trace5 <- list( uid = "d9be4b", line = list( color = "rgb(0, 42, 74)", width = 3 ), name = "Fresh fruits", type = "scatter", x = c("1978-4-18", "1978-8-8", "1978-8-31", "1978-9-13", "1978-12-2", "1979-5-25", "1979-6-20", "1979-12-2", "1980-1-31", "1980-10-2", "1980-12-31", "1981-6-12", "1981-6-27", "1981-6-1", "1981-9-24", "1981-12-15", "1982-4-25", "1982-8-8", "1982-7-13", "1982-10-23", "1983-2-2", "1983-1-20", "1983-7-12", "1983-7-5", "1983-12-4", "1984-3-28", "1984-6-16", "1984-5-30", "1984-8-6", "1984-7-20", "1984-9-14", "1984-11-16", "1985-2-19", "1985-5-22", "1985-9-13", "1985-12-11", "1986-3-30", "1986-6-18", "1986-9-17", "1986-12-15", "1987-1-22", "1987-5-26", "1987-7-4", "1987-10-10", "1987-10-16", "1988-2-14", "1988-3-30", "1988-6-1", "1988-5-20", "1988-9-13", "1989-1-16", "1989-3-21", "1989-6-26", "1989-8-27", "1989-7-26", "1989-11-5", "1990-2-5", "1990-2-22", "1990-2-28", "1990-6-22", "1990-7-18", "1990-10-17", "1990-9-19", "1990-10-2", "1990-11-22", "1990-11-22", "1990-12-30", "1991-1-24", "1991-3-20", "1991-5-1", "1991-6-1", "1991-6-1", "1991-8-13", "1991-9-16", "1991-11-30", "1992-1-3", "1992-3-6", "1992-8-5", "1992-8-19", "1992-7-7", "1992-8-19", "1993-1-13", "1993-5-21", "1993-5-26", "1993-8-23", "1993-12-13", "1994-5-4", "1994-10-17", "1994-10-4", "1995-1-20", "1995-3-15", "1995-2-21", "1995-2-21", "1995-8-31", "1996-1-2", "1996-3-21", "1996-6-11", "1996-7-26", "1996-11-23", "1997-2-2", "1997-3-3", "1997-7-30", "1997-12-17", "1998-3-29", "1998-2-19", "1998-8-25", "1998-12-21", "1998-11-26", "1999-2-6", "1999-5-10", "1999-7-13", "1999-8-7", "1999-8-20", "1999-12-9", "2000-3-23", "2000-6-4", "2000-5-22", "2000-6-8", "2000-10-31", "2001-1-23", "2001-1-23", "2001-5-17", "2001-6-12", "2001-11-16", "2002-3-31", "2002-7-29", "2002-11-28", "2003-3-22", "2003-7-2", "2003-9-10", "2004-1-9", "2004-1-9", "2004-4-17", "2004-8-19", "2004-9-7", "2004-11-16", "2004-11-9", "2005-5-2", "2005-3-17", "2005-8-18", "2005-8-29", "2006-1-25", "2006-3-4", "2006-5-11", "2006-5-11", "2006-8-20", "2006-12-13", "2007-2-6", "2007-2-14", "2007-3-20", "2007-7-24", "2007-7-17", "2008-1-1", "2008-2-24", "2008-6-8", "2008-8-27", "2008-9-13", "2008-12-7", "2009-1-27", "2009-2-9"), y = c(1.0346994535519127, 1.0567915690866512, 1.088342440801457, 1.0714936247723135, 1.0241347905282332, 1.057103825136612, 1.0714936247723132, 1.0150273224043715, 0.9913479052823315, 0.970992714025501, 0.9617486338797814, 0.9133489461358313, 0.9318306010928963, 0.8920765027322404, 0.9419398907103824, 0.9818989071038251, 0.9986338797814207, 0.9724043715846995, 1.001366120218579, 0.9508196721311475, 0.906041287188828, 0.8852459016393442, 0.9141295862607337, 0.9535519125683061, 0.907103825136612, 0.9023224043715847, 0.9656648451730419, 0.9467213114754098, 0.99408014571949, 0.9795081967213115, 1.0237704918032786, 1.0477231329690344, 1.055464480874317, 1.0323315118397085, 1.0161657559198543, 1.0009107468123861, 1.0078064012490242, 1.0341530054644807, 1.0525197328476017, 1.0676229508196722, 1.0951730418943533, 1.1055815768930524, 1.1188524590163933, 1.0978483606557377, 1.1215846994535519, 1.091188524590164, 1.1086065573770492, 1.180327868852459, 1.1345628415300548, 1.20264116575592, 1.1582422586520948, 1.146516393442623, 1.1521857923497265, 1.1974043715846996, 1.1734972677595628, 1.2167577413479052, 1.240255009107468, 1.2568306010928962, 1.2469945355191256, 1.2670765027322406, 1.2459016393442623, 1.2327868852459016, 1.1970628415300546, 1.2144808743169402, 1.2937158469945356, 1.260928961748634, 1.3142076502732243, 1.3346994535519128, 1.3638433515482697, 1.39032006245121, 1.4214480874316942, 1.4043715846994536, 1.3374316939890711, 1.3208430913348947, 1.3101092896174862, 1.2791438979963572, 1.2628073770491803, 1.2545537340619308, 1.236338797814208, 1.2170613236187005, 1.2827868852459017, 1.2249544626593807, 1.2144808743169397, 1.1953551912568305, 1.2476092896174862, 1.2938524590163936, 1.2904143897996359, 1.2925204918032787, 1.2780054644808743, 1.3224043715846996, 1.3624121779859486, 1.346174863387978, 1.3312841530054644, 1.3961748633879782, 1.3743169398907105, 1.405054644808743, 1.42374565325385, 1.4439890710382515, 1.4513661202185792, 1.423952641165756, 1.4080796252927401, 1.3997609289617485, 1.4026639344262295, 1.4335154826958107, 1.4166666666666665, 1.4488463873709774, 1.5040983606557379, 1.48224043715847, 1.5204159077109898, 1.549863387978142, 1.5382513661202186, 1.5204918032786885, 1.5027322404371584, 1.4830210772833725, 1.4226775956284152, 1.3968969555035127, 1.3793260473588342, 1.3674863387978142, 1.428376268540203, 1.4112021857923498, 1.3907103825136613, 1.4326047358834244, 1.4371584699453552, 1.4336672738312084, 1.4336065573770493, 1.422326307572209, 1.4328324225865212, 1.4362477231329693, 1.4676684881602915, 1.4412568306010929, 1.4330601092896176, 1.4173497267759565, 1.4500000000000002, 1.4281762295081966, 1.4121129326047357, 1.4525273224043715, 1.4801001821493627, 1.4480874316939891, 1.4267418032786887, 1.4574551131928186, 1.4439890710382515, 1.4763856362217016, 1.4867941712204011, 1.4635245901639347, 1.4439890710382515, 1.501062537947784, 1.507513661202186, 1.5523679417122043, 1.5318761384335156, 1.521857923497268, 1.4987639864689042, 1.4836065573770494, 1.5185792349726779, 1.5279078844652616, 1.5388368462138955, 1.5532786885245904, 1.5318761384335156, 1.4990892531876139, 1.4814207650273226, 1.4642531876138438), marker = list(line = lis)), error_x = lis), error_y = lis), textfont = lis) ) data <- list(trace1, trace2, trace3, trace4, trace5) layout <- list( font = list( size = 12, color = "rgb(33, 33, 33)", family = "\"Georgia\", serif" ), smith = FALSE, title = "The Cost of Healthy Eating", width = 700, xaxis = list( type = "date", unit = "", dtick = "M60", range = c(258008400000, 1241841600000), tick0 = 946702800000, ticks = "outside", title = "", anchor = "y", domain = c(0, 1), mirror = FALSE, nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = FALSE, tickfont = list( size = 0, color = "", family = "" ), zeroline = FALSE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "rgba(0, 0, 0, 0)", tickwidth = 1, titlefont = list( size = 0, color = "", family = "" ), overlaying = FALSE, showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), yaxis = list( type = "linear", unit = "", dtick = 0.2, range = c(0.5632547392565607, 1.605385212170276), tick0 = 0, ticks = "outside", title = "Change in Monthly Food Prices (%)", anchor = "x", domain = c(0, 1), mirror = FALSE, nticks = 0, ticklen = 5, autotick = TRUE, position = 0, showgrid = TRUE, showline = FALSE, tickfont = list( size = 0, color = "", family = "" ), zeroline = FALSE, autorange = TRUE, gridcolor = "#ddd", gridwidth = 1, linecolor = "#000", linewidth = 1, rangemode = "normal", tickangle = "auto", tickcolor = "rgba(0, 0, 0, 0)", tickwidth = 1, titlefont = list( size = 0, color = "", family = "" ), overlaying = FALSE, showexponent = "all", zerolinecolor = "#000", zerolinewidth = 1, exponentformat = "e", showticklabels = TRUE ), bargap = 0.2, boxgap = 0.3, height = 475, legend = list( x = 0.023453023064673607, y = 0.9486015633255951, font = list( size = 0, color = "", family = "" ), bgcolor = "rgb(255, 255, 255)", xanchor = "auto", yanchor = "auto", traceorder = "reversed", bordercolor = "rgba(0, 0, 0, 0.29)", borderwidth = 0.5 ), margin = list( b = 80, l = 80, r = 80, t = 80, pad = 2, autoexpand = TRUE ), barmode = "stack", boxmode = "overlay", autosize = FALSE, dragmode = "zoom", hovermode = "x", titlefont = list( size = 0, color = "rgb(33, 33, 33)", family = "" ), separators = ".,", showlegend = TRUE, annotations = list( list( x = -0.03888888888888889, y = -0.22380954197474878, ax = -58, ay = 152.04687452316284, tag = "", font = list( size = 0, color = "", family = "" ), text = "
Lines show change in price of items since 1978, relative to overall inflation as measured by the
Consumer Price Index. Source: Bureau of Labor Statistics", xref = "paper", yref = "paper", align = "left", bgcolor = "rgba(0,0,0,0)", opacity = 1, xanchor = "auto", yanchor = "auto", arrowhead = 1, arrowsize = 1, borderpad = 1, showarrow = FALSE, arrowcolor = "", arrowwidth = 0, bordercolor = "", borderwidth = 1 ) ), bargroupgap = 0, boxgroupgap = 0.3, hidesources = FALSE, plot_bgcolor = "#fff", paper_bgcolor = "#fff" ) p <- plot_ly() p <- add_trace(p, uid=trace1$uid, line=trace1$line, 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, textfont=trace1$textfont) p <- add_trace(p, uid=trace2$uid, line=trace2$line, 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, textfont=trace2$textfont) p <- add_trace(p, uid=trace3$uid, line=trace3$line, 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, textfont=trace3$textfont) p <- add_trace(p, uid=trace4$uid, line=trace4$line, 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, textfont=trace4$textfont) p <- add_trace(p, uid=trace5$uid, line=trace5$line, 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, textfont=trace5$textfont) p <- layout(p, font=layout$font, smith=layout$smith, 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, barmode=layout$barmode, boxmode=layout$boxmode, autosize=layout$autosize, dragmode=layout$dragmode, hovermode=layout$hovermode, titlefont=layout$titlefont, separators=layout$separators, showlegend=layout$showlegend, annotations=layout$annotations, bargroupgap=layout$bargroupgap, boxgroupgap=layout$boxgroupgap, hidesources=layout$hidesources, plot_bgcolor=layout$plot_bgcolor, paper_bgcolor=layout$paper_bgcolor)