5
$\begingroup$

I'm trying to Plot data in Mathematica that I upload from Excel.

The Excel file has 5 columns. The first column I would like to be the x-values, and the remaining 4 columns are y-values.

How to plot each of the curves on the same axes?

I tried the following:

data = Import["cyclic-nc-100-t2-t1 formatted.xlsx"];
ListPlot[data]

and it won't work...

While it does work for an Excel spreadsheet with just two columns (first column being $x$, second column being $y$).

The following link lets you download the spreadsheet https://drive.google.com/file/d/1ZoiwC_F9o3tQOPvQWPQVP1jR05VZ9AXz/view?usp=sharing

$\endgroup$

2 Answers 2

3
$\begingroup$

This is very similar to the answer by @DavidG.Stork, but I would encourage to always limit the scope of the definitions, in this case using With, but also Module and Block. Also, indenting code makes it more readable.

With[
 {
  data = Import["cyclic-nc-100-t2-t1 formatted.xlsx"]
  },
 ListPlot[
  {
   data[[1, All, {1, 2}]],
   data[[1, All, {1, 3}]],
   data[[1, All, {1, 4}]],
   data[[1, All, {1, 5}]]
   }
  , PlotTheme -> "Scientific"
  ]
 ]

Mathematica graphics

$\endgroup$
1
$\begingroup$
ListPlot[{{xdata=data[[All,1]],data[[All,2]]},
                            {xdata,data[[All,3]]},
                            {xdata,data[[All,4]]}}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.