# How to build one data from other data ListLinePlot

I want to build:

ListLinePlot[{en, v1} // Transpose]


I want:

but the third plot is a problem:

 data1={1,2,3,4,5, 6, 7, 8, 9, 10} (* number of points *)
data2={3.3, 3.1, 3, 3.5, 3.13, 2.4, 2.12, 2.87, 4.3, 5} (* values of voltage *)
data3={14, 27, 125, 256, 350, 14, 19, 126, 250, 310} (*values of angle*)

ListLinePlot[{data1, data2}// Transpose] (*It's Okey*)

ListLinePlot[{data1, data3}// Transpose] (*It's Okey*)

ListLinePlot[{data3, data2}// Transpose] (*Picture below*)


• Did you try to sort the list of points? Mar 14, 2017 at 22:48
• Probably not. How to do it? I try to apply "Thread" and MapIndexed, but there was a mistake in the syntax.
– Alex
Mar 14, 2017 at 22:53
• If the list of points is like {{x1,y1},{x2,y2},{x3,y3}}, then Sort[list, #[[1]]<#2[[1]]&] is quite good. See the complete syntax in the Documentation. Mar 14, 2017 at 22:55
– Kuba
Mar 14, 2017 at 23:04
• No, I want to replace data 2 with data 3, but with the values saved by the number of points. In the figure above, the X axis contains data 3, but they are not in order, and there are in the range from 0 to 359. But axis X must be in the range [0 ... number points] with different values [0...359]
– Alex
Mar 14, 2017 at 23:06

So working from the data sample you provided for Kuba in a comment we have this:

data1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
data2 = {3.3, 3.1, 3, 3.5, 3.13, 2.4, 2.12, 2.87, 4.3, 5};
data3 = {14, 27, 125, 256, 350, 14, 19, 126, 250, 310};

Row@
{
Transpose@{data1, data2} //
ListLinePlot[#, ImageSize -> 200] &,
Transpose@{data1, data3} //
ListLinePlot[#, ImageSize -> 200] &,
SortBy[Transpose@{data3, data2}, First] //

ListLinePlot[#, ImageSize -> 200] &
}


Which gives this as the output:

Obviously this is dataset too small to know if that's really what you wanted but try it out with the full data.

So I think what you're actually trying to get at is labelling that first plot with the angle values. Here's a way to do it:

ListLinePlot[
Transpose@{data1, data2},
Ticks -> {
MapIndexed[{First@#2, #} &, data3],
Automatic
}
]


• Yes, It is alright. Thank you so much.
– Alex
Mar 15, 2017 at 6:47
• @Alex so then your problem was what Riccardo Cazzin identified. Namely your points needed to be sorted (this was I think everyone's guess from the plots you provided). Mar 15, 2017 at 6:48
• I looked at the answer carefully, and still it's a bit wrong. I want 10 values on the X axis, but only so that they are not in order, but in the same sequence as originally at data3.
– Alex
Mar 15, 2017 at 7:00
• @Alex If they aren't in order in terms of their x-values the line going between them will be a zig-zagging mess, as you saw. Do you want something like ListPolarPlot? You said that data3 is a bunch of angles. Mar 15, 2017 at 7:06
• I want ListLinePlot, but that instead of the number of points along the X axis, the values of the angle without sorting are assigned. Example Axis X must: {35, 48,167,270,358,24,59,79 and etc.}, that is, instead of the values of the points, the values of the angle without sorting are substituted.
– Alex
Mar 15, 2017 at 7:12