SUMO
Simulation of Urban MObility

- Home
- Download
- Documentation
- Wiki
- Trac
- Blog
- Contact
- SF-Project

# Tools/Visualization

The tools are meant to be named as following: <API>_<DATA>_<DESCRIPTION>.py, where:

- <API>: mpl for matplotlib
- <DATA>: the SUMO-output that is processed (mainly)
- <DESCRIPTION>: what the tool does

# mpl_dump_twoAgainst.py

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

Either shows the plot (when --show is set) or saves it into a file (when --output <FILE> is set).

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

You can format the axes by using --xticks <XMIN,XMAX,XSTEP,FONTSIZE> and --yticks <YMIN,YMAX,YSTEP,FONTSIZE> and set theit limits using --xlim <XMIN,XMAX> and --ylim <YMIN,YMAX>. The output size of the image may be set using --size <WIDTH,HEIGHT>.

# mpl_tripinfos_twoAgainst.py

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

Either shows the plot (when --show is set) or saves it into a file (when --output <FILE> is set).

You can format the axes by using --xticks <XMIN,XMAX,XSTEP,FONTSIZE> and --yticks <YMIN,YMAX,YSTEP,FONTSIZE> and set theit limits using --xlim <XMIN,XMAX> and --ylim <YMIN,YMAX>. The output size of the image may be set using --size <WIDTH,HEIGHT>.

# mpl_dump_timeline.py

Reads a value (given as --value <VALUE>, default speed) for edges defined via --edges <EDGEID>[,<EDGEID>]* from the dumps defined via --dumps <DUMP>[,<DUMP>]*. Plots them as time lines, using the colors defined via --colors <MPL_COLOR>[,<MPLCOLOR>]*. Please note that the number of colors must be equal to number of edges * number of dumps.

Either shows the plot (when --show is set) or saves it into a file (when --output <FILENAME> is set).

You can format the axes by using --xticks <XMIN,XMAX,XSTEP,FONTSIZE> and --yticks <YMIN,YMAX,YSTEP,FONTSIZE> and set theit limits using --xlim <XMIN,XMAX> and --ylim <YMIN,YMAX>. The output size of the image may be set using --size <WIDTH,HEIGHT>.

# mpl_dump_onNet.py

Reads a network (defined using --net-file <NET> or -n <NET>) and an edge-dump file (--dump <DUMPFILE> or -d <DUMP_FILE>}}). Plots the network using the geometries read from <NET>. Both the width and the colors used for each edge are determined using --value <WIDTHVALUE>,<COLORVALUE> where both <WIDTHVALUE> and <COLORVALUE> are attributes within the dump-file that exist for each edge.

You can change the used color map by setting --color-map <DEFINITION>. <DEFINITION> 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 <COLORVALUE> 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 --show is set) or saves it into a file (when --output <FILENAME> is set).

--join sums up the values found for each edge and divides the result by the number of these values. If join is not set and --output is given, one should choose an output name which looks as following: <NAME>'%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 --xticks <XMIN,XMAX,XSTEP,FONTSIZE> and --yticks <YMIN,YMAX,YSTEP,FONTSIZE> and set theit limits using --xlim <XMIN,XMAX> and --ylim <YMIN,YMAX>. The output size of the image may be set using --size <WIDTH,HEIGHT>.

This page was last modified on 12 September 2011, at 06:47.