This is complete mystery for me, but I am unable to plot the following data... I have two lists, that I want to ListPlot. The data is created in the following way (I edited the code for more clarity):

xx = Table[i, {i, 1.485, 1.5, .001}];
yy = Table[0, {i, Length[xx]}];

Then, I run a For on all the elements of yy to change their value. In the end, I get the following list:

yy = {2.2005*10^(-3),2.34527*10^(-3),2.50062*10^(-3),2.66517*10^(-3),2.83694*10^(-3),3.01328*10^(-3),3.19072*10^(-3),3.36471*10^(-3),3.52911*10^(-3),3.6752*10^(-3),3.7894*10^(-3),3.84831*10^(-3),3.80618*10^(-3),3.55756*10^(-3),2.79023*10^(-3),0.}

The thing is, when I try to


it does not work. I have to manually copy (copy as plain text) the generated list in place of yy, and then it works.

What's wrong with my yy? If needed I will copy the code that I use to change that list, but it is quite long... So if anybody knows that this kind of behavior is typical of something, please let me know.

Edited: xx and yy have the same length, sorry about that.

Also, when I try


I do get a (obviously linear) plot, which means that everything is fine with xx, but whenever I try to add yy somewhere, MMA returns an empty plot.

Edit 2: as requested, here is the output of Transpose[{xx,yy}]:


and a screenshot of it as well (just in case):

Screenshot of xx and yy

Edit 3: I forgot the FullForm. Here we go, and I guess I see that the problem comes from there...


enter image description here

  • $\begingroup$ At least for the lists you have given xx and yy are of different length and so cannot be transposed. Don't you get a error message telling you that? $\endgroup$ – sebhofer Jun 16 '16 at 13:11
  • 1
    $\begingroup$ Oops sorry I edited the question to make it more lisible, but in the end created an error... xx and yy have the same length in my code. Edit: I edited my question, thanks for the catch and sorry about that. $\endgroup$ – AnSy Jun 16 '16 at 13:13
  • 2
    $\begingroup$ Can you include the complete output of Transpose[{xx,yy}] // FullForm in your question? $\endgroup$ – Mr.Wizard Jun 16 '16 at 13:24
  • 1
    $\begingroup$ @Mr.Wizard it seems indeed that the FullForm shows that my yy is written in ScientificForm. I guess the problem comes from there... $\endgroup$ – AnSy Jun 16 '16 at 13:31
  • 1
    $\begingroup$ Formatting wrappers (like ScientificForm) will indeed cause problems; in fact they appear to be one of the most common sources of problems. A frequent example is someone setting m = {{1,2}, {3,4}} // MatrixForm and then wondering why m does not act like a matrix. The documentation and software should in my opinion do a better job of warning people of this. $\endgroup$ – Mr.Wizard Jun 16 '16 at 13:49

Based on your original post, the data you've provided for xx and yy (after you've applied some function to derive the values you've presented) are of inconsistent lengths. Therefore, when you apply Transpose it does not work and throws an error. Below is a simple example.


x = RandomInteger[{1, 100}, 100]; (*Length: 100*)
y = RandomReal[{-1, 1}, 100]; (*Length: 100*)


ListPlot[Transpose[{x, y}]]



Based on the information you've provided in your original post, here is a Plot I get.


xx = Table[i, {i, 1.485, 1.5, .001}];
yy = {2.2005*10^(-3), 2.34527*10^(-3), 2.50062*10^(-3), 
   2.66517*10^(-3), 2.83694*10^(-3), 3.01328*10^(-3), 3.19072*10^(-3),
    3.36471*10^(-3), 3.52911*10^(-3), 3.6752*10^(-3), 3.7894*10^(-3), 
   3.84831*10^(-3), 3.80618*10^(-3), 3.55756*10^(-3), 2.79023*10^(-3),

Length @ # & /@ {xx, yy} (* {91, 16*)

ListPlot[Transpose[{xx[[;; 16]], yy}]]


example 2

  • $\begingroup$ Yes, sorry, that was a mistake on my side. I did not copy correctly xx. xx and yy in my code are of the same length. When I use ListPlot[Transpose[{xx,xx}]], I get a (linear plot), but the plot gets empty whenever I try to add yy in there. $\endgroup$ – AnSy Jun 16 '16 at 13:21
  • $\begingroup$ Try ListPlot[Transpose[{xx[[;;16]],yy[[;;16]]}]] , does it work? $\endgroup$ – e.doroskevic Jun 16 '16 at 13:24

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