Objectives


  • Manipulate the concept of page
  • Understand the concept of subpage
  • Create a complex layout

You will need to download


Finally, A bit of layout ...

As we already did in on of the previous part of the tutorial, we will use the pseudo action page to do that to organise the diverses plots in a complex layout

The position of a page is set with the 4 following parameters

  • page_x_position / page_y_position : to position in cm the bottom left corner of the page in its parent
  • page_x_length / page_y_length : the dimension in cm.

The drawing area ( where the plotting is rendered) is called subpage and can position into the page using the 4 following parameters

  • subpage_x_position / subpage_y_position : to position in cm the bottom left corner of the drawing area (subpage)  in its parent page.
  • subpage_x_length / subpage_y_length : the dimension in cm.
    layout

Parameters to check


 

Useful page parameters

layout

page_x_position
page_y_position
page_x_length
page_y_length
subpage_x_position
subpage_y_position
subpage_x_length
subpage_y_length
page_id_line
page_frame
Python - complex layout
# importing Magics module
from Magics.macro import *
from map import map
from xsection import xsection
from profile import profile
from timeserie import msl_timeserie
from timeserie import precip_timeserie
from trajectories import trajectories
#Setting the output
output = output(output_name = 'magics', 
                output_formats = ["ps", "png"],
                output_name_first_page_number = "off")
top_left = page(
        layout='positional',  
        page_x_length=14., 
        page_y_length=10., 
        page_id_line='off',
        page_x_position=0., 
        page_y_position=10.5)
top_right = page(layout='positional', 
        page_x_length=14., 
        page_y_length=10., 
        page_id_line='off',
        page_x_position=15., 
        page_y_position=10.5, 
        subpage_x_position=0.5,
        subpage_y_position=0.5,
        subpage_vertical_axis_width=0.5,
        subpage_horizontal_axis_height=0.5,
        )
profile_left = page(
        layout='positional',
        page_frame='off', 
        page_x_length=5., 
        page_y_length=11., 
        page_id_line='off',
        page_x_position=0.5, 
        page_y_position=0.5, 
        subpage_x_position=0.5,
        subpage_y_position=0.5,
        )
graph_bottom = page(
        layout='positional',
        page_frame='off', 
        page_x_length=8., 
        page_y_length=5., 
        page_id_line='off',
        page_x_position=5.5, 
        page_y_position=0.5, 
        subpage_x_position=1.5,
        subpage_y_position=0.5,
        )        
graph_top = page(
        layout='positional',
        page_frame='off', 
        page_x_length=8., 
        page_y_length=5., 
        page_id_line='off',
        page_x_position=5.5, 
        page_y_position=5.5, 
        subpage_x_position=1.5,
        subpage_y_position=0.5,
        )
bottom_right = page(layout='positional', 
        page_x_length=14., 
        page_y_length=10., 
        page_id_line='off',
        page_x_position=15., 
        page_y_position=0.5, 
        subpage_x_position=0.5,
        subpage_y_position=0.5,
    )
centre = page(layout='positional', 
        page_x_length=5., 
        page_y_length=4., 
        page_id_line='off',
        page_x_position=11.5, 
        page_y_position=10., 
        subpage_frame='off'
        )        
bottom_right = page(layout='positional', 
        page_x_length=15., 
        page_y_length=11., 
        page_id_line='off',
        page_x_position=15., 
        page_y_position=0.5, 
        subpage_x_position=0.5,
        subpage_y_position=0.5,
        )
title = mtext(
        text_lines= ["Magics Tutorial"],
        text_html= 'true',
        text_justification= 'centre',
        text_font_size= 1.,
        text_colour= 'charcoal',
        text_font_style= 'bold',
        text_box_blanking='on',
        text_border='on',
        text_mode='positional',
        text_box_x_position = 0.,
        text_box_y_position = 0.00,
        text_box_x_length = 7.,
        text_box_y_length = 1.5,
        text_border_colour='charcoal'
        )
plot(output, 
    top_left, map(), 
    top_right, xsection(), 
    profile_left, profile(),
    graph_bottom, msl_timeserie(),
    graph_top, precip_timeserie(),
    bottom_right, trajectories(),
    centre, title
    )

Download the full solution..

Go Back to the Magics Tutorial main page ...