... | ... | @@ -112,69 +112,79 @@ run1.data['results'] |
|
|
```
|
|
|
|
|
|
|
|
|
---- STEP 4: Visualising some RUN data
|
|
|
## STEP 4: Visualising the data
|
|
|
|
|
|
In "mymodule/myAxes" are a few files starting with ax these contain classes of Axes.
|
|
|
These classes are build over a general class MyAxes (from myplotlib). The class MyAxes
|
|
|
is build such that it can be used with any user defined class build on MyFig.
|
|
|
We will start with the class AxResults (see axResults.py)
|
|
|
In `mymodule/myAxes` are a few examples of axes classes.
|
|
|
These classes are build over a general class `MyAxes` (from myplotlib). The class `MyAxes`
|
|
|
is build such that it can be used with any user-defined class build on `MyFig`.
|
|
|
We will start with the class `AxResults` (see `axResults.py`)
|
|
|
|
|
|
In order to plot the Axes we need to integrate it into a Figure.
|
|
|
For the confort of the user, myplotlib comes with a few standard classes like FigOneAxes3D.
|
|
|
This class is build over MyFig (compatible with any MyAxes) and can be used as a container
|
|
|
for a single MyAxes.
|
|
|
In order to plot the axes we need to integrate it into a figure.
|
|
|
For the comfort of the user, `myplotlib` comes with a few standard classes like `FigOneAxes3D` (see myplotlib/mytools/figOneAxes3D.py).
|
|
|
This class is build over `MyFig` (compatible with any `MyAxes`) and can be used as a container
|
|
|
for a single `MyAxes` instances.
|
|
|
|
|
|
We can now create a figure fig an instance of FigOneAxes3D with the
|
|
|
dataset (run1,) given to the class AxResults.
|
|
|
We can now create a figure `fig` of type `FigOneAxes3D` with the
|
|
|
dataset `(run1,)` given to the axes class `AxResults`.
|
|
|
|
|
|
>>> # Create a figure to show the data
|
|
|
>>> fig = FigOneAxes3D((run1,), AxResults)
|
|
|
```python
|
|
|
# Create a figure
|
|
|
fig = FigOneAxes3D((run1,), AxResults)
|
|
|
```
|
|
|
|
|
|
you can now type:
|
|
|
|
|
|
>>> fig
|
|
|
<mymodule.myplotlib.mytool.figOneAxes3D.FigOneAxes3D at ...>
|
|
|
```python
|
|
|
fig
|
|
|
>>> <mymodule.myplotlib.mytool.figOneAxes3D.FigOneAxes3D at ...>
|
|
|
```
|
|
|
|
|
|
We can also access the axes:
|
|
|
|
|
|
>>> fig.get_axes()
|
|
|
[<mypltemplate.myAxes.axResults.AxResults at ...>]
|
|
|
```python
|
|
|
fig.get_axes()
|
|
|
>>> [<mypltemplate.myAxes.axResults.AxResults at ...>]
|
|
|
```
|
|
|
|
|
|
or even store the axes into a variable:
|
|
|
|
|
|
>>> ax = fig.get_axes()[0]
|
|
|
>>> ax
|
|
|
<mypltemplate.myAxes.axResults.AxResults at ...>
|
|
|
|
|
|
The FigOneAxes3D has (alike any MyFig instance) a function plot()
|
|
|
The plot function will call all plotting function of all axes contained in FigOneAxes3D.
|
|
|
In that case just one ax.plotting.
|
|
|
The plotting function will act on some attributes of the AxResults ax.
|
|
|
It will change the label for example.
|
|
|
```python
|
|
|
ax = fig.get_axes()[0]
|
|
|
ax
|
|
|
>>> <mypltemplate.myAxes.axResults.AxResults at ...>
|
|
|
```
|
|
|
|
|
|
>>> # The label of the axes before plotting
|
|
|
>>> ax.get_xlabel()
|
|
|
u''
|
|
|
The object `fig` has (alike any `MyFig` instance) a function `plot()`
|
|
|
The `plot` function will call all `plotting` function of all axes contained in `fig`.
|
|
|
> For this example only `ax.plotting()`.
|
|
|
The `plotting` function will act on some attributes of ax.
|
|
|
> For instance it will change the label.
|
|
|
|
|
|
>>> # CALL the PLOT procedure
|
|
|
>>> fig.plot()
|
|
|
```python
|
|
|
# The label of the axes before plotting
|
|
|
ax.get_xlabel()
|
|
|
>>> u''
|
|
|
|
|
|
>>> # The label after plotting
|
|
|
>>> ax.get_xlabel()
|
|
|
u'${\\rm x}~[{\\rm m}]$'
|
|
|
# CALL the PLOT procedure
|
|
|
fig.plot()
|
|
|
|
|
|
As you can see any part of the object can be access for more details
|
|
|
see matplotlib documentation (http://matplotlib.org/api/axes_api.html)
|
|
|
# The label after plotting
|
|
|
ax.get_xlabel()
|
|
|
>>> u'${\\rm x}~[{\\rm m}]$'
|
|
|
```
|
|
|
|
|
|
As you can see any part of the object can be access.
|
|
|
for more details see matplotlib documentation [doc](http://matplotlib.org/api/axes_api.html)
|
|
|
|
|
|
Now it is time to show the data set on the screen. To do so myplotlib
|
|
|
comes with a class called MyWin. This class will create a window,
|
|
|
Now it is time to show the data set on the screen. To do so `myplotlib`
|
|
|
comes with a class called `MyWin`. This class will create a window,
|
|
|
containing a canvas.
|
|
|
- The window has some buttons like close, reduce and so one...
|
|
|
- The canvas can be seen as a white sheet of paper
|
|
|
on which you will draw a Figure (only one figure can be drawn on a canvas).
|
|
|
- The **window** has some buttons like close, reduce and so one...
|
|
|
- The **canvas** can be seen as a white sheet of paper
|
|
|
on which you will draw a figure (only one figure can be drawn on a canvas).
|
|
|
|
|
|
>>> # Create a window where the figure is shown
|
|
|
>>> win = MyWin(fig)
|
|
|
|
|
|
This should produce a window on which fig should be plotted. |
|
|
\ No newline at end of file |
|
|
```python
|
|
|
# Create a window where the figure is shown
|
|
|
win = MyWin(fig)
|
|
|
```
|
|
|
This should produce a window on which `fig` should be plotted. |
|
|
\ No newline at end of file |