Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a CSV data file with X position, Y position and corresponding intensity as Z.

I would like to plot it to form an image. I have an idea that list density plot is one method,but, somehow the importing of the CSV file as table and plotting is resulting in an error :

Read::readn: "Invalid real number found when reading from "test2 10 10.csv."

I am totally new to Mathematica and just learning. I don't understand why it takes so long to even import a CSV file.

Thanks !

share|improve this question
It may help to get a good answer if you post your code and some example data. I'm sure you'll have a solution in no time at all then –  image_doctor May 6 '12 at 10:41
Please try to isolate the specific issue that's causing problems, and post a minimal working examples (i.e. the smallest code snippet and input file that reproduces the problem). It seems that you are having trouble importing from CSV---this is a separate problem from plotting. We can't find out what goes wrong with the CSV import without seeing a sample data file (please try to create the smallest possible CSV that reproduces the problem, preferably just a few lines, and post it together with the code you used for importing) –  Szabolcs May 6 '12 at 10:56
Did you try Import? –  Sjoerd C. de Vries May 6 '12 at 13:56
add comment

2 Answers

(*Testing ...
First we generate some points*)
points = Flatten[Table[{x, y, PDF[BinormalDistribution[{0, 0}, {1, 2}, .5], {x, y}]}, 
                       {x, -3, 3, .1}, {y, -3, 3, .1}], 1];
Now we export it as a csv
Export["c:\\points.csv", points];

(* The file looks like this:
(* Finally import it and plot*)


enter image description here


I had no problems at all downloading your sample file and plotting it:

enter image description here

share|improve this answer
example data in csv file : docs.google.com/open?id=0B6yei5eTKtEsbEFVODUwblEzMjQ –  abhilash sukumari May 11 '12 at 1:47
@abhilashsukumari See edit –  belisarius May 11 '12 at 2:43
add comment

Looking at the sample file, it seems that your data may be on a regular grid:

data = Import["wafer test 5-8-12 test5.csv"];

data = GatherBy[data, First];

Equal @@ dd[[All, All, 2]]

==> True

which means that we could also use ArrayPlot, if you want a more 'discrete' appearance:

ArrayPlot[Transpose[dd[[All, All, 3]]], ColorFunction -> "SolarColors"]

enter image description here

I had to transpose my data since I gathered by the x values, so each row of data ends up being constant x instead of y. Also you might want to use the DataReversed option for ArrayPlot, since ArrayPlot and ListDensityPlot treat arrays slightly differently.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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