Changes
Page history
yfournier created page: create your first figure
authored
Feb 16, 2017
by
Yori Fournier
Show whitespace changes
Inline
Side-by-side
create-your-first-figure.md
View page @
35599396
...
@@ -54,7 +54,7 @@ from ..myplotlib import MyFig
...
@@ -54,7 +54,7 @@ from ..myplotlib import MyFig
# Begin of the class
# Begin of the class
class
figMyFirstFigure
(
MyFig
):
class
figMyFirstFigure
(
MyFig
):
# The function where you declare the user-defined keywords
# The function where you declare the user-defined keywords
(optional)
def
declareKeywords
(
self
):
def
declareKeywords
(
self
):
# The size of the figure can be also defined here (optional)
# The size of the figure can be also defined here (optional)
...
@@ -83,20 +83,20 @@ class figMyFirstFigure(MyFig):
...
@@ -83,20 +83,20 @@ class figMyFirstFigure(MyFig):
```
```
# Linking the new class to the module
# Linking the new class to the module
Now that the
axes
class is created we just need to link it to the module.
Now that the
figure
class is created we just need to link it to the module.
To do so you need to add the following line in
`mymodule/my
Ax
es/__init__.py`
To do so you need to add the following line in
`mymodule/my
Figur
es/__init__.py`
```
python
```
python
from
ax
MyFirst
Axes
import
Ax
MyFirst
Axes
from
fig
MyFirst
Figure
import
Fig
MyFirst
Figure
```
```
the module
`mymodule`
import by default all
ax
es in the sub-module
`my
Ax
es`
, so you just need
the module
`mymodule`
import by default all
figur
es in the sub-module
`my
Figur
es`
, so you just need
to tell
`my
Ax
es`
to load the class
`
Ax
MyFirst
Axes
`
from the file
`
ax
MyFirst
Axes
`
.
to tell
`my
Figur
es`
to load the class
`
Fig
MyFirst
Figure
`
from the file
`
fig
MyFirst
Figure
`
.
# Using the
axes
# Using the
figure
Now you are ready to play with your new
axes
:
Now you are ready to play with your new
figure
:
```
python
```
python
from
mymodule
import
*
from
mymodule
import
*
data
=
...
data
=
...
fig
=
Fig
OneAxes2D
((
data
,),
AxMyFirstAxes
)
fig
=
Fig
MyFirstFigure
((
data
,
data
)
)
win
=
MyWin
(
fig
)
win
=
MyWin
(
fig
)
```
```
\ No newline at end of file