and here is the code

reset set sample 30 set table 'bubble.dat' p [0:5] sin(x*3.0)*exp(-x)+rand(0)/10.0 unset table xs=-0.007 ys=0.002 unset key set object 1 rect from screen 0,0 to screen 1,1 behind fillcolor rgb "#ddddff" set border back set xlabel 'Time [s]' set ylabel 'Position [m]' p [-0.1:5] 'bubble.dat' u 1:2 w p ps 3 pt 7 lc rgb "#ff0000", \ '' u ($1+xs):($2+ys) w p ps 2.6 pt 7 lc rgb "#ff2222", \ '' u ($1+xs):($2+ys) w p ps 2.2 pt 7 lc rgb "#ff4444", \ '' u ($1+xs):($2+ys) w p ps 1.8 pt 7 lc rgb "#ff6666", \ '' u ($1+xs):($2+ys) w p ps 1.4 pt 7 lc rgb "#ff8888", \ '' u ($1+xs):($2+ys) w p ps 1.0 pt 7 lc rgb "#ffaaaa", \ '' u ($1+xs):($2+ys) w p ps 0.6 pt 7 lc rgb "#ffcccc", \ '' u ($1+xs):($2+ys) w p ps 0.2 pt 7 lc rgb "#ffeeee"

The red parts are really irrelevant: the first one just produces some dummy data, we have seen this so many times that it is becoming boring. Then we define two variables (blue) 'xs' and 'ys', and draw a rectangle, just to have some background. In the last 8 lines we plot our data 8 times, each time in a different colour (the colour successively becomes whiter) and in different size (the points successively become smaller). At the same time, the centre of the circles is shifted by 'xs' and 'ys', so that we give the impression that the spheres are lit from the top left corner. By modifying these values, you can move your virtual light source.

The are only three caveats here: one is that since we apply a shift to the data points, we have got to make sure that our xrange and yrange supports the shifter data. This is why, while we have data in [0:5], our xrange is actually [-0.1:5]. The yrange does not require special attention in this case.

The second caveat is that it is perfect for a raster image, it will look quite nasty on a vector image. If you plan on printing the graph through postscript or pdf, you will have to define more levels for the transition from red to white. But the idea is the same, you will simply have more plots.

And third, when you define your 'xs' and 'ys', you have to make sure that the successive plots fall on the first one, otherwise your bubbles will have some funny shape.

Greetings!

ReplyDeleteYou did what I exactly wanted to, and wasn't able to do. I also like very much the contour post.

Your scripts are REALLY very useful, and they show that apparently simple gnuplot may be used to produce impossible graphs!

I am using gnuplot for everyday work and for producing graphs for publications. I thought I know a lot, but after seeing your blog I understood that there is much more potential in that software than I could ever imagine.

Many thanks!

With regards,

Dianthus