Skip to content
Clifford Bohm edited this page Sep 17, 2022 · 12 revisions

this page is out of data - the command is in the tools directory now it's still called mgraph.py. To run it from work you can call 'python ../tools/mgraph.py' (most everything else is mostly correct)

MABE comes with a Python tool called mgraph.py which can generate graphs from MABE data.

Requirements

In order to make graphs, you will need to have Python with matplotlib (a graphing package for python), numpy and pandas installed. If you installed MABE using the (Installation and quick start)[Installation-and-getting-started-with-MABE] page you already have what you need. If you choose to install python on your own, it is advised to install the latest version of python (version 3.0 or later as opposed to 2.x).

MGraph.py

mgraph.py is a graphing program that makes graphs from csv files.
Let's get this out of the way... mgraph will not generate all of the possible graphs that you might need, but it does provide a way for you to visualize your data quickly with minimal effort.

to run mgraph.py enter:

python [path to your MABE code]/tools/mgraph.py

If you run MGraph.py in a directory where you have run MABE, graphs will automatically be generated from the pop.csv and max.csv files. A set of graphs are generated for every column in pop.csv, and from the same columns in max.csv.

After a few seconds, you should see images like these...

To quit, either close these images or press <ctrl-c> on the command line.

using mgraph to make Custom Graphs

MGraph.py can also render custom graphs. For example to create a graph from pop.csv showing food1, food2, score and switches:

python mgraph.py -files pop.csv -data food1_AVE food2_AVE score_AVE switches_AVE -combineData -pltStyle randomLine"

saving graphs with mgraph.py

The -s option allows you to save a plot. The formate of the image is determined by the file name (.png or .pdf).

python tools/mgraph.py -files pop.csv -data food1_AVE -s graph.png"

will graph food1_AVE and save this to "graph.png".

mhraph.py -h option

We continue to add features to mgraph.py. To see all of the options run mgraph.py with the "-h" option.

python tools/mgraph.py -h
Clone this wiki locally