0

I hope I don't get firebombed here, this is the first time I'm posting. Lol

So after a grueling simulation, I have this large data set of the form r, θ, and T(r,θ). I needed to plot a contour map for this data set. θ is in degrees.

So I ran to GNUPlot and I hoped that this will save me from my problems. I studied a bit about how it works, but I still cannot plot my 2D contour data.

I then researched about my problem then I saw this thread here in SE: gnuplot 2D polar plot with heatmap from 3D dataset - possible?

I used both codes (that I assume to be working) in that post and NONE is working with my dataset. I hope someone can help me with my problem.

This is what I changed the code into:

reset
set terminal pngcairo size 800,800
set output '3d-polar.png'

set lmargin at screen 0.05
set rmargin at screen 0.85
set bmargin at screen 0.1
set tmargin at screen 0.9

set pm3d map
unset key

set multiplot

# plot the heatmap
set parametric
set isosamples 500

unset border
unset xtics
unset ytics

set angles degree
r = 0.05 # CHANGED THIS
set urange[0:r] # radius
set vrange[0:360] # angle
set xrange[-r:r]
set yrange[-r:r]
set colorbox user origin 0.9,0.1 size 0.03,0.8
splot 'data.dat' using 1:2:3    # CHANGED THIS

# now plot the polar grid only
set style line 11 lc rgb 'white' lw 2
set grid polar ls 11
set polar
set rrange[0:r]
unset raxis
set rtics format '' scale 0
unset parametric
set for [i=0:330:30] label at first (r+0.35)*cos(i), first (r+0.35)*sin(i)\
center sprintf('%d', i)
plot NaN w l
unset multiplot
Community
  • 1
  • 1
  • Please share your currnt work. – Olcay Ertaş May 08 '17 at 13:21
  • I just used the code existing on the link I gave. It doesn't work with mine. I tried replacing some things in there such as the radius and the rest, but no avail. – Allan Paolo May 08 '17 at 14:07
  • I edited the post to include the code I changed the source into. – Allan Paolo May 08 '17 at 14:12
  • Also, regardless of what edit I make, this always comes out. http://i64.tinypic.com/2ylrd76.png – Allan Paolo May 08 '17 at 14:15
  • Probably an error with your data format. But to analyze that we would need the data. – Christoph May 08 '17 at 14:27
  • Hi. I managed to make it work but it looks... rather disastrous. Apparently I had to convert it to cartesian coordinates and this happened: http://i67.tinypic.com/a2x5kp.png Please check the 'update' I made below. Thanks! – Allan Paolo May 08 '17 at 14:39
  • If it helps this is my data set (LARGE): Polar: https://pastebin.com/72FQmdce Cartesian: https://pastebin.com/M36KanBG – Allan Paolo May 08 '17 at 14:55
  • To add: While the temperature only varies with the radius (it is the same for any angle); I would like to make it work for a general case where it is possible that the temperature varies with both radius and angle. – Allan Paolo May 08 '17 at 15:03

1 Answers1

0

So I had this little 'eureka' moment. Apparently I had to put dgrid3d and had to convert the coordinates from polar to cartesian.

Upon converting (and putting set dgrid3d) this ugly plot appeared:

reset
set terminal pngcairo size 800,800
set output '3d-polar.png'

set lmargin at screen 0.05
set rmargin at screen 0.85
set bmargin at screen 0.1
set tmargin at screen 0.9

set pm3d map
unset key

set multiplot

# plot the heatmap
set parametric
set isosamples 500

unset border
unset xtics
unset ytics

set angles degree
r = 0.05 # CHANGED THIS
set urange[0:r] # radius
set vrange[0:360] # angle
set xrange[-r:r]
set yrange[-r:r]
set colorbox user origin 0.9,0.1 size 0.03,0.8
set dgrid3d         # ADDED THIS
splot 'data.dat' using 1:2:3    # CHANGED THIS

# now plot the polar grid only
set style line 11 lc rgb 'white' lw 2
set grid polar ls 11
set polar
set rrange[0:r]
unset raxis
set rtics format '' scale 0
unset parametric
set for [i=0:330:30] label at first (r+0.35)*cos(i), first (r+0.35)*sin(i)\
center sprintf('%d', i)
plot NaN w l
unset multiplot

The plot.

I'm at my limit here now. Three questions. 1. Am I correct to assume that I can use the mathematics in gnuplot to convert the coordinates from polar to cartesian? Or is there a way for me to use the polar coordinate data immediately? 2. How do I limit the 'colors' to the round polar plot? 3. What happened to the degree and radius readings? Where did they go?

Thanks!