0
$\begingroup$

I have two large columns of data which both have a dimension of {2485,1}. Now I want to plot these two columns versus together. I have tried ListLinePlot[{col1, col2}] but it doesn't give the correct plot. I think that it draws both columns versus ordered numbers (1,2,3,...). However, I need a plot which its x-axis be col1 and its y-axis be col2. How can I obtain such a plot?

$\endgroup$
  • $\begingroup$ No, it returns just an empty plot! $\endgroup$ – Wisdom May 1 at 7:32
  • $\begingroup$ It doesn't work! $\endgroup$ – Wisdom May 1 at 7:44
  • $\begingroup$ @Wisdom what is the error message? ListLinePlot[Transpose[{col1, col2}]] should work. $\endgroup$ – Picaud Vincent May 1 at 7:46
  • $\begingroup$ @PicaudVincent It doesn't return any error but an empty graph (namely just two axes). Is it possible my large data cause such a situation? $\endgroup$ – Wisdom May 1 at 7:59
  • $\begingroup$ @HighPerformanceMark Thanks a lot $\endgroup$ – Wisdom May 1 at 8:00
2
$\begingroup$
ListLinePlot[Transpose[Flatten /@ {col1, col2}]]

The problem is that your col1 and col2 aren't lists, as you say, but rather they are $2485\times1$ matrices.

$\endgroup$
  • $\begingroup$ Thanks, it workes, however, this command gives me a plot which has not the appropriate x-axis. Namely the correct x-axis starts by 613 and ends up by 0.000001 for example. this is while the obtained plot has an x-axis which starts at 0 and ends by 2.5! what is the problem? $\endgroup$ – Wisdom May 1 at 8:39
  • $\begingroup$ Have you tried PlotRange->All? $\endgroup$ – Roman May 1 at 8:40
  • $\begingroup$ Ohhh my god! it worked finally! Thanks a lot, dear Roman. I didn't know it is necessary to write the range because I thought that Mathematica includes all of my data. Thanks again $\endgroup$ – Wisdom May 1 at 8:44
  • $\begingroup$ You're welcome. Don't hesitate to up-vote and to accept the answer. $\endgroup$ – Roman May 1 at 8:47
  • $\begingroup$ another question: how can I tell Mathematica to compress some rigions of x-axis and expand some other regions? In fact, I want to enhance the resolution of my graph because the variations of my data are not the same on all x-axis $\endgroup$ – Wisdom May 1 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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