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
ListPlot[Transpose[{xx,yy}]
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
ListPlot[Transpose[{xx,xx}]]
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}]:
{{1.485,2.2005*10^(-3)},{1.486,2.34527*10^(-3)},{1.487,2.50062*10^(-3)},{1.488,2.66517*10^(-3)},{1.489,2.83694*10^(-3)},{1.49,3.01328*10^(-3)},{1.491,3.19072*10^(-3)},{1.492,3.36471*10^(-3)},{1.493,3.52911*10^(-3)},{1.494,3.6752*10^(-3)},{1.495,3.7894*10^(-3)},{1.496,3.84831*10^(-3)},{1.497,3.80618*10^(-3)},{1.498,3.55756*10^(-3)},{1.499,2.79023*10^(-3)},{1.5,0.}}
and a screenshot of it as well (just in case):
Edit 3: I forgot the FullForm. Here we go, and I guess I see that the problem comes from there...
List[List[1.485`,ScientificForm[0.002200504961592269`]],List[1.486`,ScientificForm[0.002345269356606834`]],List[1.487`,ScientificForm[0.0025006194693353036`]],List[1.488`,ScientificForm[0.0026651682379572796`]],List[1.489`,ScientificForm[0.002836940677699209`]],List[1.49`,ScientificForm[0.0030132826042305045`]],List[1.491`,ScientificForm[0.0031907205430207306`]],List[1.492`,ScientificForm[0.003364706805684322`]],List[1.493`,ScientificForm[0.003529114711632648`]],List[1.494`,ScientificForm[0.00367520103764892`]],List[1.495`,ScientificForm[0.0037893969768483197`]],List[1.496`,ScientificForm[0.0038483114614672803`]],List[1.497`,ScientificForm[0.0038061835870495412`]],List[1.498`,ScientificForm[0.003557560962432392`]],List[1.499`,ScientificForm[0.0027902318774610966`]],List[1.5`,ScientificForm[0.`]]]
xx
andyy
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:11Transpose[{xx,yy}] // FullForm
in your question? $\endgroup$ – Mr.Wizard♦ Jun 16 '16 at 13:24ScientificForm
) will indeed cause problems; in fact they appear to be one of the most common sources of problems. A frequent example is someone settingm = {{1,2}, {3,4}} // MatrixForm
and then wondering whym
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