I have a hard time trying to understand why I get the floating-point error
in this
particular case: I dont't see what's wrong with the list I am trying to
plot.
Here it is:
In[1]:= small=Take[vec,2]
Out[1]:= { {30.06, 23523}, {56. 38,00005}}
In[2]:= ListPlot[small]
Then I get the error message:
Graphics::gptn : Coordinate 30.06 in {30.06, 23523} is not a floating-point
number.
Hope someone can explain this to me.
Best regards,
Henning Heiberg-Andersen
small={{30.06,23523},{56. 38,5}};
ListPlot[small, PlotStyle -> PointSize[0.02]]
(*plot to be displayed*)
Looking at what you posted, I am confident that the values hold by vec
are in string format. You can check that with Map[Head, small, {-1}].
Now you can transform the strings into expressions by using
ToExpression, but beware that your data set seems odd: an entry such as
00005 is going to be converted as 5. However, 56. 38 will become 2128.
since the white space is going to be interpreted as implicit multiplication.
In[1]:=
small={{"30.06","23523"},{"56. 38","00005"}}
Out[1]=
{{30.06,23523},{56. 38,00005}}
In[2]:=
ListPlot[small];
From In[2]:=
Graphics::"gptn":"Coordinate 30.06 in {30.06, 23523} is not a
floating-point number.
In[3]:=
Map[Head,small,{-1}]
Out[3]=
{{String,String},{String,String}}
In[4]:=
small=ToExpression[small]
Out[4]=
{{30.06,23523},{2128.,5}}
In[5]:=
Map[Head,small,{-1}]
Out[5]=
{{Real,Integer},{Real,Integer}}
In[6]:=
ListPlot[small];
Regards,
Jean-Marc
can you tell me how we shall find out what input
produce
| Out[1]:= { {30.06, 23523}, {56. 38,00005}}
because
{56. 38,00005}
is what ??
{56.38, 5}
or
{56.39, "00005"}
??
Regards
Jens
"Henning Heiberg-Andersen"
<henning.hei...@gmail.com> schrieb im
Newsbeitrag news:egvbr1$s16$1...@smc.vnet.net...
Sorry, I did not get your error message.
Is the space in 56. 38 also in your notebook?
Bye
Ben
Henning Heiberg-Andersen schrieb:
If I copy your "small", I don't have any problem...
Maybe your vec is interpreted as text?
Try
ListPlot[ToExpression[small]]
Hope it helps!
Regards
Florian Jaccard
-----Message d'origine-----
De : Henning Heiberg-Andersen [mailto:henning.hei...@gmail.com]
Envoyé : lundi, 16. octobre 2006 08:37
À : math...@smc.vnet.net
Objet : "Not a floating-point number" WHY?