Create scientific plots using gnuplot

January 31st, 2014 | 14 Comments

And another plot of the world. This time we are dealing with the raster data from Natural Earth. This data is normally available as tif-files. To use them in gnuplot we have to convert them first, then we can create a plot as shown in Fig. 1.

Cross-blended Hypsometric Tints

Fig. 1 Cross-blended hypsometric tint plot of the world. (code to produce this figure, data)

The conversion is done by the convert_natural_earth script. There the tif-file is first scaled down to the desired resolution using imagemagick. Afterwards it is converted to a text file and reordered for the splot command of gnuplot. The text file includes the longitude, latitude and three rgb color values.
You have to invoke the script in the following way.

$ ./convert_natural_earth $RES $FILE

where $RES is the desired resolution in pixel of your gnuplot plot and $FILE the input tif-file.
After finished we can plot the resulting text file simply by

set datafile separator ','
set size ratio -1
plot 'HYP_50M_SR_W_350px.txt' w rgbimage

which results in Fig. 1.

Natural Earth II Shaded Relief and Water

Fig. 2 Natural Earth II shaded relief and water plot of the world. (code to produce this figure, data)

The image can also be projected on a 3D figure of the world as shown in Fig. 2. To achieve this the three rgb values have to be summarized in one value and the rgb variable line color option has to be chosen together with pm3d.

rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
set mapping spherical
set angles degrees
splot 'NE2_50M_SR_W_700px.txt' u 1:2:(1):(rgb($3,$4,$5)) w pm3d lc rgb variable


  1. JJ says:

    In order to properly project the 3D figure, you need to change the terminal size to be equal (for example ‘350,350’), and to add the following:

    set view equal xyz
    set xyplane relative 0.0
  2. hagen says:

    Ah, cool. Here is the corresponding result after adding your settings.

    Natural Earth II Shaded Relief and Water

    Fig. 3 Natural Earth II shaded relief and water plot of the world. (code to produce this figure, data)

  3. SH says:

    When I modify the code as
    set view 90,90,1.75
    instead of the original one
    set view 67,113,1.75
    , plotting the Eastern Hemisphere becomes somehow strange…
    It seems that the range of 90 < x < 180 is plotted reversely while 0 < x < 90 is not.
    I'm using Version 5.0 patchlevel 3.

  4. Does Louis Vuitton have an outlet?Can we trust outlet stores selling Louis Vuitton handbags? Outlet stores claiming to sell authentic Louis Vuitton handbags are not associated with Louis Vuitton.LOUIS VUITTON Official USA Website – Explore the World of Louis Vuitton, read our latest News, discover our Women’s and Men’s Collections and locate.Insane collection of Louis Vuitton, all guaranteed authentic. LV Neverfull totes, Speedy bags, Alma satchels & more. Safe shipping and easy returns.

  5. C.G INC supply 100% authentic Louis Vuitton outlet here offers cheap Louis Vuitton,authentic Louis Vuitton,Louis Vuitton handbags,Louis Vuitton bags,Louis Vuitton purses online with free shipping.Welcome to Louis Vuitton official website and enjoy shopping in our Louis Vuitton sale online store.

  6. Do Louis Vuitton bags ever go on sale?Louis Vuitton Neverfull, Louis Vuitton Speedy, Louis Vuitton Handbags, Replica Handbags, Cheap Handbags, Vuitton Bag, Outlet Store, Monogram Canvas, Louis Vuitton Second Hand, Louis Vuitton Outlet/Sale UK ? Buy or sell Louis Vuitton fashion items of verified quality in the REBELLE

  7. There are also news circles. Misa Patinszki’s staleness is actually the same as David Gandy’s staleness. David Gandy’s imitation effect is not good. It all depends on marketing. Naturally, there is no fashion work and inner sense of existence in 2016, so it is not allowed. Don’t get tired of Misa who looks like him and became popular.

  8. syperly says:

    cialis without prescription com 20 E2 AD 90 20Viagra 20Serve 20Para 20Jovens 20 20Viagra 20Nedir 20Zararlar 20Nelerdir viagra nedir zararlar nelerdir Old Trafford was the first time the ball really reversed in the series and Jones arrived on the scene

  9. Generally speaking, crocodile skin, alligator skin and snake skin are unique and precious leather materials that Cheap authentic Original Women louis Vuitton Sale|Authentic Women louis Vuitton Sale|Cheap Louis Vuitton Handbags Factory Outlet Online Sales sale online store ,LV will use, and most of the special leather bags have as many as 25, specially modulated normal color choices. Most women’s bags need to be made of three pieces of leather. Each piece of leather that has been carefully selected must be able to ensure the continuation of the scale pattern at the seam of the bag, and each process must be handled carefully to ensure that the color and luster of each leather are perfectly matched. Each piece of leather must be polished daily with agate stone Two times, creating a perfectly smooth glaze effect polished on the surface. Cheap authentic Original Women louis Vuitton Sale|Authentic Women louis Vuitton Sale|Cheap Louis Vuitton Handbags Factory Outlet Online Sales sale online store ,LV Rare Leather Bag Decryption of the production process: it takes 6 weeks to paint the leather surface

  10. Yesterday, Louis Vuitton ushered in the early spring vacation of 2022 and came to the popular tourist destination “Axe Majeur” in Paris, France, bringing us an avant-garde fashion journey.

  11. ?The movie “2046” was also a design inspiration for Ghesquière

  12. After disappearing in the fashion circle for three years, Misa Patinszki’s magic finally returned to the palace, and it came back so vigorously and in such a big battle!

  13. The Vuitton 2022 early spring show came to the Louis Vuitton Cruise 2022 show. Of course, Louis Vuitton chose a surprising location to showcase its latest series. The performance is located in Ax Majeur on the outskirts of the French capital, a 3.2 km long straight path. Shark starts from the village of Sergi and passes through a wrestling, architectural landscape of the city of Paris. Composed of 12 modern parts, extending from the top of the city center to the collapse of one of Wawa, the scenery is superb.

Leave a Reply