https://github.com/caley/OpenEPSim
Revision 28c0d6270bfd2b99845492565fe2907418ae74c6 authored by Caley Finn on 05 March 2018, 04:10:53 UTC, committed by Caley Finn on 05 March 2018, 04:10:53 UTC
1 parent 2307cc1
Raw File
Tip revision: 28c0d6270bfd2b99845492565fe2907418ae74c6 authored by Caley Finn on 05 March 2018, 04:10:53 UTC
Build jar with all dependencies
Tip revision: 28c0d62
plotdensity.py
#
#
# Plot density profiles from simulation results.  Usage:
#     python plotdensity.py resultsfile.json
#

import json
import matplotlib.pyplot
import os.path
import sys

if __name__ == "__main__":
    resultsfile = sys.argv[1]

    fp = open(resultsfile)
    results = json.load(fp)
    fp.close()

    title = os.path.basename(resultsfile)

    densities = results['results']['density']

    xs = range(1, len(densities[1]) + 1)

    i = 0
    for ds in densities:
        matplotlib.pyplot.plot(xs, ds, "o-", label=str(i))

        i += 1

    matplotlib.pyplot.legend()
    matplotlib.pyplot.gcf().canvas.set_window_title(title)

    matplotlib.pyplot.show()
back to top