In our examples, the Python program only calculates the x, y coordinates of points. We use gnuplot to turn these into graphs, and there are many different styles. These examples go into the .plot file, and the actual plot command is always last.
unset border unset tics
Example: Red stars of size 2
plot "ifs.dat" pt 3 ps 2 lc rgb "red"where
Gnuplot knows plenty of named colours. For anything else, use hex triplets such as lc rgb '0xbb44dd'. You can find these in drawing programs or online, for example rose colours.
Example:
set term png size 2048,2048 background "black"The resolution also defines the shape of the image file. So if your graph is wider than it is tall, use something like 2048,1024.
The default background colour is white. Black and white are probably the most useful, but you can try any others, including rgb hex triplets.
By default, gnuplot gives just enough space to show all your points. But in some cases you may want to adjust the ranges. Let's say your point coordinates stay between 0 and 1, but you want a little extra space on the sides. Then you can use
set xrange [-0.2:1.2] set yrange [-0.2:1.2]to make some margins. It's a good idea to keep the coordinate axes visible at first, so you can easily see the ranges. You can turn them off later.
Another way to set margins:
set lmargin at screen 0.05 set rmargin at screen 0.95 set bmargin at screen 0.05 set tmargin at screen 0.95meaning: left, right, bottom, top margins. 0 is left/bottom edge and 1 is top/right, so the numbers are defined accordingly.
For more advanced multi-colour graphs, you may want to try palettes. A palette in gnuplot is a series of colours on a number line from 0 to 1. For starters, start gnuplot (interactive mode) and try
test paletteYou should see the default palette that goes from black via purple and red to yellow. To choose a single colour, use for example
plot sin(x) lc palette frac 0.33to use the purple at 0.33.
For a nice multi-stage plot, try something like
plot "ifs6.dat" pt 0 lc palette frac 0, \ "ifs7.dat" pt 0 lc palette frac 0.25 \ "ifs8.dat" pt 0 lc palette frac 0.5, \ "ifs9.dat" pt 0 lc palette frac 0.75, \ "ifs10.dat" pt 0 lc palette frac 1, \
For other palettes, try some of
set palette rgbformulae 21,22,23 set palette rgbformulae 23,28,3 set palette rgbformulae 7,5,15 set palette rgbformulae 3,11,6 set palette rgbformulae 33,13,10 set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8
To define your own palettes, start with something like
set palette model HSV functions gray, 1, 1and look up the HSV colour model.
For better quality prints, use more and smaller points. This makes processing slower, so always try with the basic quality first.
In the Python program, increase the number of points, for example "ninit = 100000".
In Gnuplot, increase the resolution and use smaller points. We aim for A3 prints, so we need
set term png size 3510,4950 plot "ifs.dat" pt 0or 4950,3510 for horizontal/landscape pictures.
In some cases, you may also want more iterations (niter = ... in Python) for sharper detail. However, if you're doing colour stages, make sure you have the correct .dat files in the .plot file.
If you keep the coordinate borders, you should increase the font size of the numbers:
set term png size 3510,4950 font "Andale-Mono,65"
Generally, prints will look a little darker than the original images on a computer. So for the final touch, keep your picture bright enough. For dark colours on white, reduce ninit a little. Or for light colours on a dark background, increase ninit a little.
Running "gnuplot" without any files gets you the interactive mode. This can be useful for testing certain features. You can also try simple plots such as
plot x + sin(x)You can exit the interactive mode by pressing Ctrl+D.