Tools/Visualization

SUMO offers a wide range of outputs, but one may find it hard to parse and visualize them. The suite includes some tools that are presented in the following that allow to visualize a simulation run's results so that they can be used in a scientific paper. Additional tools read plain .csv-files and were added to the suite as they offer a similar interface.

The tools share a set of common options to fine-tune the appearence of the generated figures. These options' names where chosen similar to the matplotlib calls.

The tools are implemented in Python and need matplotlib to be installed. The tools can be found in /tools/visualization.

=Current Tools= Below, You will find the descriptions of tools that should work with the current outputs SUMO/SUMO-GUI generate. To run them, you'll need: All scripts are executed from the command line and You have to give the command line options as listed in the descriptions below. Please note that may be applied to all the scripts listed in the following sub-sections.
 * to install Python
 * to install matplotlib
 * to set

plot_summary.py
The options of plot_summary.py are shown in the following table:

plot_tripinfo_distributions.py
The options of plot_summary.py are shown in the following table:

plot_csv_timeline.py
The options of plot_csv_timeline.py are shown in the following table:

plot_csv_pie.py
The options of plot_csv_pie.py are shown in the following table:

plot_csv_bars.py
The options of plot_csv_pie.py are shown in the following table:

common options
The following options are common to all previously listed tools. They can be divided into two groups: The options are listed and discussed in the following sub-sections, respectively.
 * options for formatting the figure (including adding captions etc.)
 * options for determining what to do with the generated figure

Interaction Options
If one of the scripts is simply started with no options that are listed below, the figure will be shown. To write the figure additionally into a file, the filename to generate must be given using the (or  for short).

If the script is run in a batch file, it is often not convenient to show the figure (once known it is as it should be). In such cases, the option  can be used that suppresses showing the figure.

=Outdated= The tools are meant to be named as following: __.py, where:
 * : mpl for matplotlib
 * : the SUMO-output that is processed (mainly)
 * : what the tool does

mpl_dump_twoAgainst.py
Reads two dump files (mandatory options and, or, for short  and ). Extracts the value described by (default: speed). Plots the values of dump2 over the according (same interval time and edge) values from dump1.

Either shows the plot (when is set) or saves it into a file (when  is set).

You can additionally plot the normed sums of the value using. In the other case, you can try to use to assign different colors to the read intervals.

You can format the axes by using and  and set theit limits using  and. The output size of the image may be set using.

mpl_tripinfos_twoAgainst.py
Reads two tripinfos files (mandatory options and, or, for short  and ). Extracts the value described by (default: duration). Plots the values of tripinfos2 over the according (same vehicle) values from tripinfos1.

Either shows the plot (when is set) or saves it into a file (when  is set).

You can format the axes by using and  and set theit limits using  and. The output size of the image may be set using.

mpl_dump_timeline.py
Reads a value (given as, default speed) for edges defined via from the dumps defined via. Plots them as time lines, using the colors defined via. Please note that the number of colors must be equal to number of edges * number of dumps.

Either shows the plot (when is set) or saves it into a file (when  is set).

You can format the axes by using and  and set theit limits using  and. The output size of the image may be set using.

mpl_dump_onNet.py
Reads a network (defined using or ) and an edge-dump file ( or '-d ''}}). Plots the network using the geometries read from . Both the width and the colors used for each edge are determined using where both  and  are attributes within the dump-file that exist for each edge.

You can change the used color map by setting.  is made of a sorted list of values (between 0 and 1) and assigned colors. This means that the default 0:#ff0000,.5:#ffff00,1:#00ff00 let streets with low value for  appear red, for those in the middle yellow and for those with a high value green. For values between the given values, the color is determined using linear interpolation. Please note that only lowercase hexadecimal characters may be used.

Either shows the plot (when is set) or saves it into a file (when  is set).

sums up the values found for each edge and divides the result by the number of these values. If join is not set and is given, one should choose an output name which looks as following: %05d.png. The %05d will be replaced by the current time step written.

If you have generated a set of images by not "joining" (aggregating) the data, you can convert the obtained pictures into an animated gif using ImageMagick and the following command: convert -delay 20 *.png -loop 0 animation.gif (loop 0 means that the animation repeats from begin after the end)

You can format the axes by using and  and set theit limits using  and. The output size of the image may be set using.