0

I have a 3D dataset consisting of 3 columns that are: radius (it's an angular variable going from 0 to 90 degrees), azimuthal angle and a function (called T) dependent on both radius and azimuth. For each value of radius in the column I have the whole range of values of the azimuth from 0 to 2*pi, and in the third column the corresponding T function value.

I want to make a 2D polar plot, a heatmap that shows the "intensity" of T depending on the radius and the azimuth.The image 1 attached shows how the variables should be represented, and the image 2 is the corresponding heatmap in gray scale. 1 2 I have been trying also in GNUPLOT, but I never get the diagram I need. Anyone knows the way? Any advice about what direction to take would be appreciated.

**EDIT: I don't know if it's possible to attach a dataset file, but this would be a similar one (shortened): The three columns are r, θ, and T(r,θ). For every value of r radius, I want to go across the whole range of the azimuth from 0 to 2*pi (around 6 in radians), and then the third column is the value which i want to make the heatmap for.

0. 0. 5.00000284249414
0. 1. 5.00000284249414
0. 2. 5.00000284249414
0. 3. 5.00000284249414
0. 4. 5.00000284249414
0. 5. 5.00000284249414
0. 6. 5.00000284249414
 
1. 0. 3.567825199007075
1. 1. 5.667040835607859
1. 2. 6.066435899369931
1. 3. 3.620258279907404
1. 4. 5.228476464535639
1. 5. 6.387721052369126
1. 6. 3.775570161705905
 
2. 0. 3.351247019698203
2. 1. 5.782995557435527
2. 2. 6.255369591592488
2. 3. 3.410630384522823
2. 4. 5.267292704344917
2. 5. 6.6370705238320606
2. 6. 3.5870354029796603
 
3. 0. 4.956427159288734
3. 1. 5.018192922028904
3. 2. 5.02858888162984
3. 3. 4.9581591194569505
3. 4. 5.006358999209049
3. 5. 5.036713105661448
3. 6. 4.963218764930239
  • 1
    `DensityPlot` and the variations of that are what Mathematica calls HeatMap. Any chance you might be able to use ideas from this post? https://mathematica.stackexchange.com/questions/128160/listdensityplot-of-a-data-set-in-polar-coordinates There doesn't seem to be a polar version of that supplied by MMA, but you might be able to transform your polar coordinates into rectangular. If that isn't enough then perhaps you could explain a little more and possibly even give a small example dataset and perhaps that would be enough to enable someone to help you more. – Bill May 14 '23 at 22:37
  • Hi, thank you for your answer! I had already seen that post, but my dataset is of the kind {r,θ,f[r,θ]}, 3 columns ( have attached a sample in the question). And I need it to be represented in polar coordinates, with the radial and angular labels... – Patricia Guillo May 16 '23 at 07:50
  • Try `rthetadata={{0.,0.,5.00000284249414},...{3.,6.,4.963218764930239}}; polarToxy[{r_,theta_,mag_}]:={r Cos[theta],r Sin[theta],mag}; xydata=Map[polarToxy,data]; ListDensityPlot[xydata]` and see if that is acceptable. If not the let me know how it needs to change and I'll see what I can do. Test this BRUTALLY! Maybe try to make some fake data that you know exactly what it is supposed to display and see if it does precisely that. – Bill May 16 '23 at 15:13
  • Sorry for the late response, I didn't get the notification. Thanks for your answer, it worked and I finally managed to get what I needed. – Patricia Guillo May 25 '23 at 10:17

1 Answers1

0

Your question does not provide enough information or sample data to provide an example that matches exactly, but perhaps this plot from the gnuplot demo collection is close enough to give you a next step. You can then modify the question to show what you have done and what is not working the way you would like. The original example is the 8th plot here: parametric plots.

Here is a stripped down version showing both a 3D representation and the 2D projection you get from set view map.

#
# Decouple range of parametric axes u/v from that of display axes x/y/z
#
set label 1 "Decouple range of parametric axes u/v\nfrom that of display axes x/y/z"
set label 1 at screen 0.1, 0.9
unset colorbox
set palette cubehelix cycle 3
set view equal xyz
set view 120, 300
set xyplane 0
set pm3d depthorder
set border 4095
set tics scale 0
set format ""
set angles radians
xx(u, v) = cos(v) * cos(u)
yy(u, v) = cos(v) * sin(u)
zz(u, v) = sin(v)
color(u, v) = sin(2*u)+sin(2*v)
#
set parametric
set isosamples 121, 61
set samples 121, 61
set urange [-pi:pi] 
set vrange [-pi/2:pi/2]
set xrange [-1:1] 
set yrange [-1:1]
set zrange [-1:1]
splot "++" using (xx($1,$2)):(yy($1,$2)):(zz($1,$2)):(color($1,$2)) with pm3d notitle

3D view 2D projection

Ethan
  • 13,715
  • 2
  • 12
  • 21
  • Thanks for your answer! I don't think that demo code is what i need exactly. In fact, the exact problem I have is the question in this link: https://stackoverflow.com/questions/43848204/gnuplot-plotting-a-data-set-in-polar-form-r-%ce%b8-tr-%ce%b8-to-a-contour-heat-map/43850600#43850600 . He uses the code from this other question: https://stackoverflow.com/questions/18792461/gnuplot-2d-polar-plot-with-heatmap-from-3d-dataset-possible which is also my problem but it is never answered about a certain dataset, but about a function directly in gnuplot. – Patricia Guillo May 15 '23 at 17:06
  • I have edited the question with a data sample, in case it explains better the issue. – Patricia Guillo May 15 '23 at 17:17
  • Gnuplot's pm3d mode needs a full grid, so a partial data set will not work as input in this case. There is a new plot style in the gnuplot development version that would handle even fragmentary data, but that is not yet in the current stable release https://gnuplot.sourceforge.net/demo_6.0/polargrid.html – Ethan May 15 '23 at 20:01
  • I need a full grid too, the azimuth has to go through the whole range of 360 degrees. – Patricia Guillo May 16 '23 at 08:00