Section | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
First step
In order to be able to create and use Magics objects, the Magics python package has to be imported.
Any Magics plot will be triggered using the plot command.
A basic plot could be a geographical map, using the default projection, and the default attributes of coastlines.
Magics will instantiate the default driver, a Postscript driver...
Section | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Setting the output
The object outputallows the definition of the output format, and the settings of the output file name .
Have a look at the PNG output documentation to see which parameters are available to set-up a PNG output.
To create a PNG output, you have to create an output object and to insert at the first position in the plot command
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
from Magics.macro import *
#settings of the PNG output
output = output(
output_formats = ['png'],
output_name = "magics",
output_name_first_page_number = "off"
)
#The plot command will create a PNG output called magics.png
plot(output, mcoast()) |
Setting the coastlines
The object mcoast allows the parameterisation of the coastlines.
Have a look at the Coastlines documentation to see which parameters are available.
To configure the look of your coastlines you have to create a mcoast object with the parameters you want.
The mcoast object has to be inserted in the plot command.
Section | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Adding a text
Magics allows the user to add of or several lines of text. The position of the text is by default above the plot, but some parameters allow it to be moved around.
Have a look at the Text Plotting Documentation
A basic HTML formatting can be used for colour, style, and font size.
The mtext object has to be inserted in the plot command to see the text on the result.
Section | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Go to the Main Magics Tutorial...
Before you start ...
During this tutorial, you will use python and magics++ on a linux workstation.
Here is a list of basic commands you may need to use
Basic unix commands:
- ls : list the files in the current directory
- mkdir my_exercise : create a directory called my_excercise
- cd my_exercise : go to the directory my_excercise. my_excercise becomes the current directory
Using an editor:
There are several editors available
- vi :
- emacs
- kate
- nedit
Run the python interpretor :
In this tutorial we are expecting you to create a python script using your favourite editor and run python to interpret it. Your system have been set-up already and you can use Magics and python by typing the single command:
- python magics.py
Visualise your result:
Magics will generate a postscript or a png output.
- gv magics.ps : visualise a postscript file called magics.ps
- xv magics.png : visualise a postscript file called magics.png
- display magics.png : visualise a postscript file called magics.png
...