# Order plotted data points in a 2D Listplot according to a third parameter

Suppose I have these two lists:

data1 = {{2002, 120.022}, {2003, 153.253}, {2004, 112.327}, {2005,148.647}, {2006, 95.8467}, {2007, 119.702}, {2008, 120.022}, {2009,104.635}, {2010, 135.413}, {2011, 263.054}, {2012, 152.658}, {2013,271.251}, {2014, 133.85}}
data2 = {{2002, 0.33693}, {2003, 0.504899}, {2004, 0.213245}, {2005,0.292028}, {2006,0.184824}, {2007, 0.207512}, {2008, 0.33693}, {2009,0.116137}, {2010, 0.318169}, {2011, 0.23199}, {2012, 0.207042}, {2013,0.407042}, {2014, 0.316603}}


I want to plot all the second elements of data1 with those of data2, but then have it ordered according to the year. I can do this as follows

ListPlot[Transpose[{data1[[All, 2]], data2[[All, 2]]}]]


However what happens here is that the data points are ordered according to the x-elements in ascending order:

I would like the data points on the list plot to be ordered according to the year from which they arrived in ascending order - from left to right. I guess something like:

{{2002,{120.022,0.33693},{{2003,{153.253,0.504899}},...,{2014,{133.850.316603}}}


I just don't know how to get Mathematica to list plot it in that order from 2002 - 2014.

data1 = {{2002, 120.022}, {2003, 153.253}, {2004, 112.327}, {2005,
148.647}, {2006, 95.8467}, {2007, 119.702}, {2008, 120.022}, {2009,
104.635}, {2010, 135.413}, {2011, 263.054}, {2012, 152.658}, {2013,
271.251}, {2014, 133.85}};
data2 = {{2002, 0.33693}, {2003, 0.504899}, {2004, 0.213245}, {2005,
0.292028}, {2006, 0.184824}, {2007, 0.207512}, {2008, 0.33693}, {2009,
0.116137}, {2010, 0.318169}, {2011, 0.23199}, {2012, 0.207042}, {2013,
0.407042}, {2014, 0.316603}};


You want to plot data with three dimensions. There are many ways to do this.

data = Transpose[{data1, data2}] /.
{{x_, y1_}, {x_, y2_}} :> {x, y1, y2};

DateListPlot[
Labeled[{{#[[1]]}, #[[2]]}, #[[3]]] & /@
data, PlotRange -> All]


DateListPlot[
Labeled[{{#[[1]]}, #[[3]]}, #[[2]]] & /@
data]


BubbleChart[data]


BubbleChart[{#[[1]], #[[3]], #[[2]]} & /@ data]


ListPointPlot3D[data]


• Of course, I guess since I was so tunnel visioned on getting a 2D plot, i didn't think of the extensions of using 3D data. Thanks Apr 18 '17 at 12:43