Posts for the month of March 2012

OT Plotting capabilities using Matplotlib


The work on a new module has begun to plot OpenTURNS graphs through matplotlib.

Those who want a preview of the capabilities can check it out here: viewer

This development is not finalized yet, but we welcome any comments.
To test it, just download this single python script and run it, it will show the following examples.
You can copy it somewhere in your openturns python module path (/usr/lib/python2.7/dist-packages/openturns on debian/ubuntu)

import openturns as ot
from openturns.viewer import View
# create a graph
graph = ot.Normal().drawPDF()

# create a View, accepted keywords are figure.add_subplot+axes.plot/axes.pie/ ones depending on the kind of graph
view = View(graph, plot_kwargs={'color':'blue'})

# save to a file, accepted keywords are figure.savefig ones'curve.png', dpi=100)

# show the graph on the screenn, accepted keywords are ones

Here are a few samples:
/raw-attachment/blog/Matplotlib%20module/curve1.png /raw-attachment/blog/Matplotlib%20module/curve2.png
/raw-attachment/blog/Matplotlib%20module/curve3.png /raw-attachment/blog/Matplotlib%20module/curve4.png
/raw-attachment/blog/Matplotlib%20module/curve5.png /raw-attachment/blog/Matplotlib%20module/curve6.png
/raw-attachment/blog/Matplotlib%20module/curve7.png /raw-attachment/blog/Matplotlib%20module/curve8.png
/raw-attachment/blog/Matplotlib%20module/curve9.png /raw-attachment/blog/Matplotlib%20module/curve10.png