5

I have a function dependent on phi and theta, which I want to plot on the surface of a sphere. The date is stored in a .txt file with the columns:

1: x = R*sin(theta)*cos(phi)
2: y = R*sin(theta)*sin(phi)
3: z = R*cos(theta)
4: density

I use the following gnuplot code to plot:

set terminal wxt size 800,800
set mapping cartesian
set view equal xyz
set xlabel 'x'
set ylabel 'y'
set zlabel 'z'
splot "densityprofile_100.000.txt" u 1:2:3:4 with pm3d
pause -1

Unfortunately Gnuplot doesn't seem to be able to properly represent the colours on the sphere. There seems to be some shadow, which I can not get rid off; see the picture here:

enter image description here

When I turn the sphere with my mouse, the shadow gets smaller and bigger, but there is no position in which it fully disappears. Any help is appreciated.

user1118321
  • 25,567
  • 4
  • 55
  • 86
Klamauk
  • 111
  • 1
  • 6
  • Please upload the image somehere and post the link. Then someone with higher reputation can include it for you. Also, please provide the data file, which allows to reproduce/test/fix your problem. – Christoph Feb 20 '15 at 10:57
  • A guess: try using `set autoscale cbfix`, so that color range spans only exactly the values which you have in your data file. – Christoph Feb 20 '15 at 11:20
  • Ok, I added the image inline. Could you also upload your data file somewhere? Without having it I cannot check what's wrong. – Christoph Feb 23 '15 at 12:27
  • found the solution. if the datafile is still needed anyways for user users, let me know and i'll tryu to upload it. – Klamauk Feb 23 '15 at 15:47

2 Answers2

5

I found the solution to my problem by adding the following line:

set pm3d depthorder
Klamauk
  • 111
  • 1
  • 6
1

At a guess, maybe the depth ordering is causing some trouble. Have you tried the pm3d "hidden3d" option?

from the gnuplot help on pm3d:

The option hidden3d takes as the argument a linestyle which must be created by set style line .... (The style need not to be present when setting pm3d, but it must be present when plotting). If set, lines are drawn using the specified line style, taking into account hidden line removal. This is by far more efficient than using the command set hidden3d as it doesn't really calculate hidden line removal, but just draws the filled polygons in the correct order. So the recommended choice when using pm3d is

 set pm3d at s hidden3d 100
 set style line 100 lt 5 lw 0.5
 unset hidden3d
 unset surf
 splot x*x+y*y
Daniel
  • 1,407
  • 1
  • 12
  • 22