# ListLinePlot of data imported from an Excel file [duplicate]

This is a continuation of another very similar question about how to plot structured data using ListLinePlot. Here is a sample data imported from an Excel file:

myNIR = {{
{, 2, 4, 6, 8, 9}, {hex, 342432, 435345, 564564, 56756, 9945},
{oct, 23, 356, 565, 304, 564}, {butane, 55, 67, 76, 44, 7}
}}


The first element of the list of lists is the independent variable (frequency). To accommodate the table form, the first element of the first list is empty.

The second, thirds and fourth lists are the experiment data. The first element of these lists are the names the experiment.

I need to plot the three-experiment data (hex, oct, butane) against frequency (first list). I like plot to include the legend.

• You can get myNIR[[1,All,2;;]] and use your previous question. For legend please add the option PlotLegend -> myNIR[[1,2;;,1]]. – ybeltukov Sep 10 '14 at 21:42

This will do what you asked for, but -- as you can see from the plot -- your three experiments don't plot well together because the hex experiment values are incommensurable with the oct and butane experiment values.

myNIR = {{
{, 2, 4, 6, 8, 9}, {hex, 342432, 435345, 564564, 56756, 9945},
{oct, 23, 356, 565, 304, 564}, {butane, 55, 67, 76, 44, 7}
}}

Module[{lbls, vals, freq},
{lbls, vals} = {#[[All, 1]], #[[All, 2 ;;]]}& @ myNIR[[1]];
lbls = lbls[[2 ;;]];
{freq, vals} = {vals[[1]], vals[[2 ;;]]};
ListLinePlot[Thread[{freq, #}]& /@ vals, PlotLegends -> lbls]]


An alternative is

Module[{lbls, vals, freq},
{lbls, vals} = {#[[All, 1]], #[[All, 2 ;;]]}& @ myNIR[[1]];
lbls = lbls[[2 ;;]];
{freq, vals} = {vals[[1]], vals[[2 ;;]]};
Column[