Tricks

This page lists tricks that I learned while using softwares.
Some of them are very tricky and worthy to be shared, that's why I made up this page.

Gnuplot

Gnuplot is "a portable command-line driven graphing utility for Linux".
This program is largely used to illustrate results in scientific papers.

Scalable output

Use SVG or PDF output to get figures that scale on papers, presentations, etc.

set term svg enhanced mouse size 600,400
set output 'default_plot.svg'

The option enhanced improves the text mode and mouse tells gnuplot to add mouse support for toggling plots (in a browser for example). You can also use another font, by adding something like font 'Verdana,9' to term option.

Attrative plots

Basic gnuplot output seems cheap, we have to admit it, but a set of a options can improve the rendering. In this example, we :

  1. select another font,
set term svg enhanced mouse size 600,400 font 'Verdana,9' rounded solid
  1. edit the style of axis and plots,
set style line 11 lc rgb '#808080' lt 1
set border 3 back ls 11
set tics nomirror
  1. display a grid.
set style line 12 lc rgb '#808080' lt 3 lw 0.5
set grid back ls 12
images/tricks/default_plot.png

Default output (script | data | svg)

images/tricks/nice_plot.png

Nice output (script | data | svg)

See also

Dot/Graphviz

Pretty diagrams

Like Gnuplot, default output looks cheap. You can select another font and edit nodes and edges style.

node [color="#808080",labelfontcolor=blue,style="rounded",shape="box", fontname=Verdana];
edge [color="#004080"];
images/tricks/diag_default.png

Default output (script)

images/tricks/diag_nice.png

Nice output (script)

UML using dot

You can directly use dot language to design UML (Frank Schoep website or Martin Elwin website). You can also use PlantUML, a tool that uses dot language.

Record structure

Dot language can be used to easily represent structures. It could be useful when illustrating network packets, tree structures, and so on. Use the following command to build the graph :

dot -Tsvg tree_struct.dot -o tree_struct.svg
images/tricks/tree_struct.png

Tree structure (data | svg)

Comments !