1
$\begingroup$

I am attempting to plot a large amount of data that I have imported from a file — dimensions {400, 2}. Both ListPlot and Plot return empty plots showing no data. When evaluating these function, Mathematica computes for a while though, as if it were processing something.

datalist = 
  {{650.`, "0.3991552293"}, {"649.5", "0.4087565541"}, ..., {450.`, "0.7589305043"}}

Both

Plot[datalist, {x, 500, 600}]

and

ListPlot[datalist]

fail to show the data.

Can anybody help?

$\endgroup$

closed as off-topic by m_goldberg, Carl Lange, MarcoB, garej, Alex Trounev May 28 at 23:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Carl Lange, MarcoB, garej, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ your datalist should have numeric entries (it has strings). Try newlist = datalist /. s_String :> ToExpression[s];ListPlot[datalist] $\endgroup$ – kglr May 24 at 7:45
  • 2
    $\begingroup$ The strings are the problem. Look up ToExpression. $\endgroup$ – MelaGo May 24 at 7:47
1
$\begingroup$

Points you should be aware of (some of which were already mentioned in comments to your question).

  • Your data contains strings. They must be converted to numbers.
  • Plot is for plotting symbolic expressions. It won't work for data pairs.

So this is how to proceed:

rawData =
  {{650.`, "0.3991552293"}, {"649.5", "0.4087565541"}, {450.`, "0.7589305043"}};
data = rawData // ToExpression;
ListPlot[data]
$\endgroup$
  • $\begingroup$ Perfect, thank you all! Makes total sense. $\endgroup$ – Student May 24 at 8:36
  • $\begingroup$ @Student. I'm glad you find my answer useful. Please consider accepting it. You can do that by clicking on the check mark that appears on the left of the answer below the down arrow. $\endgroup$ – m_goldberg May 24 at 8:44

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