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
3  
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
9  
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
4  
Did you try Import? –  Sjoerd C. de Vries May 6 '12 at 13:56
add comment

2 Answers 2

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
(*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:
-3.,-3.,0.0010207851317789406
-3.,-2.9,0.0010190852401957891
-3.,-2.8,0.0010140025313558822
-3.,-2.7,0.0010055876210847213
-3.,-2.6,0.0009939239359647277
...
*)
(* Finally import it and plot*)

ListDensityPlot[Import["c:\\points.csv"]]

enter image description here

Edit

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

Your Answer

 
discard

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.