1
$\begingroup$

I have got a vector with y values:

{{{0.}}, {{0.0572114}}, {{0.108052}}, {{0.1592}}, {{0.211456}}, {{0.263981}}, 
 {{0.316622}}, {{0.369211}}, {{0.421765}}, {{0.474278}}, {{0.526757}}}

The corresponding x-values are

{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}. 

How can I plot the values in the vector with the corresponding x-values? (I might scale the number of values up to 1000 in the future, so was a hoping for a method that can be used in that case as well. Also I would prefer a way that gives me a line, not only the points.)

$\endgroup$
1
  • 1
    $\begingroup$ Look up Flatten, ListPlot, DataRange $\endgroup$ Jan 29, 2019 at 12:24

1 Answer 1

2
$\begingroup$

One way to make the plot is

yData =
  {{{0.}}, {{0.0572114}}, {{0.108052}}, {{0.1592}}, {{0.211456}}, {{0.263981}}, 
   {{0.316622}}, {{0.369211}}, {{0.421765}}, {{0.474278}}, {{0.526757}}};
xData = Range[0, 1, .1];

ListPlot[Transpose[{xData, Flatten @ yData}]]

plot

$\endgroup$

Your Answer

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

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