0
$\begingroup$

I have a three column data. First and second columns are the position of particles in a 2D plane and the third one is the angle of each particle respect to the x-axis. I want to load and plot all particles and their orientations. How can I do that? I have found a source which says how can I load comma separated data But it doesn't work in my case because columns of my data are separated by a tab. For example, I have added a set of data here. The third column is the angle of each point in radian. I need data to be presented in different colors and each color shows the local density of points. Each point is an ellipse and third column is the angle of the principal axis.

9.009655    10.189781   1.272419
27.631693   10.815052   0.837118
31.833253   10.812191   1.031190
36.107814   10.859449   1.092497
40.484378   10.901653   0.910399
44.836425   10.892004   0.956580
49.140381   10.796349   1.154561
53.402132   10.694274   1.334286
57.816645   10.721948   1.091717
62.260830   10.747291   1.222797
66.734266   10.737636   1.309636
71.335571   10.835575   1.234170
75.729255   10.848790   1.259792
80.201332   10.766947   1.540550
84.558293   10.830055   1.258744
88.942443   10.835828   1.411807
93.258875   10.717016   1.550789
97.489009   10.589964   1.449410
101.834249  10.428415   1.260458
106.344132  10.301640   1.091424
110.511318  9.581257    1.231235
115.337717  9.734963    1.484671
119.715845  9.373837    1.615853
124.139378  9.331775    1.226453
128.459214  9.410851    1.299667
132.687740  9.495212    1.439885
137.002974  9.603081    1.478449
141.321822  9.559833    1.424466
4.376080    9.625989    1.288951
8.505736    11.861575   1.146800
8.561042    8.835473    1.075172
8.607256    10.681157   1.215328
14.443189   15.000898   1.249530
31.180269   12.923558   0.896113
35.402783   12.939329   0.857760
39.760692   12.957561   0.852959
44.171333   12.998420   1.061398
48.577317   13.018887   1.090321
52.901381   13.073019   1.151847
57.266161   13.031698   1.153219
61.672951   13.024718   1.116052
66.085101   13.030667   1.217062
70.413309   12.918668   1.338728
74.663290   13.016659   1.273071
79.047122   13.027057   1.454166
83.390386   13.022478   1.546795
87.781921   13.017219   1.474962
92.111980   13.047815   1.444732
96.450548   13.057548   1.375470
100.757872  12.949012   1.371542
105.048536  12.758074   1.411801
110.167804  12.528540   1.135017
114.398219  12.142348   1.205513
119.452792  12.284216   1.306617
123.915050  12.291978   1.431378
128.150180  12.336382   1.160349
132.398862  12.421355   1.309008
136.432666  12.404830   1.408563
140.457140  12.280224   1.270896
3.279758    12.096244   1.490805
$\endgroup$
9
  • 1
    $\begingroup$ You can import it using TSV format, instead of CSV. If you want help plotting I would recommend you provide us with some sample data, so that we can directly see what you're working with. $\endgroup$
    – ktm
    Commented Nov 9, 2017 at 14:03
  • $\begingroup$ I added a set of example data @user6014 $\endgroup$
    – Sonia Sohi
    Commented Nov 9, 2017 at 14:09
  • $\begingroup$ Please read this documentation article $\endgroup$
    – m_goldberg
    Commented Nov 9, 2017 at 14:13
  • 1
    $\begingroup$ Before anyone else tries: the third component is not the same as the two-argument arctangent applied to the first and second components. $\endgroup$ Commented Nov 9, 2017 at 14:45
  • $\begingroup$ By "oval", do you mean "ellipse"? Then you are still missing the lengths of the major and minor axes. $\endgroup$ Commented Nov 9, 2017 at 19:41

1 Answer 1

2
$\begingroup$

Edit

This is only a partial answer because further information must be supplied by the OP before region-density coloring can be addressed.

I put the data you posted into a .tsv file in my Desktop folder and then loaded it with

data = Import[FileNameJoin[{$HomeDirectory, "Desktop", "data.tsv"}]]
{{9.00966, 10.1898, 1.27242}, {27.6317, 10.8151, 0.837118},
  ...,
 {44.1713, 12.9984, 1.0614}, {48.5773, 13.0189, 1.09032}}

I then separated it into points and angles.

pts = data[[All, ;; 2]];
angles = data[[All, 3]];

The points are easy to plot.

Graphics[{AbsolutePointSize[5], Point[pts]}, Frame -> True, AspectRatio -> .6]

plot

With the additional information now added to question, I can modify my graphics to handle the angle information.

Graphics[
  MapThread[
    Inset[Graphics[Disk[{0, 0}, {2, 1}]],#1, {0, 0}, {5, 3}, {Cos[#2], Sin[#2]}] &, 
    {pts, angles}],
 Frame -> True, AspectRatio -> .6, ImagePadding -> 15, ImageSize -> {500, 300}]

plot

But I still can't do anything about the coloring because you don't tell me what metric to use to determine region density.

$\endgroup$
4
  • $\begingroup$ I don't want to simply plot the points, I want denser regions to b in different color comparing with less dense regions. Also, points are not circles, but oval and each oval makes a direction respect to x_axis. Theta shows this angle $\endgroup$
    – Sonia Sohi
    Commented Nov 9, 2017 at 18:20
  • $\begingroup$ @SoniaSohi You didn't mention ovals in your question and you supply no information except the "angle" (angle of the principal axis?). It is to get you provide such additional info in question that I have written the pseudo-answer. $\endgroup$
    – m_goldberg
    Commented Nov 9, 2017 at 19:04
  • $\begingroup$ I add the nformation in question $\endgroup$
    – Sonia Sohi
    Commented Nov 9, 2017 at 19:35
  • $\begingroup$ @SoniaSohi. You may find this question and kuba's answer relevant to your coloring problem. $\endgroup$
    – m_goldberg
    Commented Nov 10, 2017 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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