Section | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
First step
In order to be able to create and use Magics objects, the Magics python package has to be imported.
from Magics.macro import *
Any Magics plots plot will be triggered using the plot command, the simplest plot example is :
plot(mcoast())
.
A basic plot could The result will be a geographical map, using the default projection, and the default attributes of coastlines.
Magics will instantiate the default driver, a Postscript driver...
Section | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Create a postscript file called ps.ps, mcoast() create a default coastlines object.
|
Setting the output
The object outputallows the selection definition of the output format, and the setting settings of the output filename 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 Magics, 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 pngPNG output output = output( output_formats = ['png'], output_name = "magics", output_name_first_page_number = "off" ) #The plot commadcommand will create a pngPNG 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 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|