# importing Magics module
from Magics.macro import *
# define the output
output = output(output_formats=['png'],
output_name_first_page_number='off',
output_name="time_serie_step3")
# Setting the cartesian view
projection = mmap(
subpage_map_projection='cartesian',
subpage_x_axis_type='date',
subpage_y_axis_type='regular',
subpage_x_automatic='on',
subpage_y_max=5.,
subpage_y_min=0.,
)
# Vertical axis
vertical = maxis(
axis_orientation='vertical',
axis_grid='on',
axis_type='regular',
axis_tick_label_height=0.4,
axis_tick_label_colour='charcoal',
axis_grid_colour='charcoal',
axis_grid_thickness=1,
axis_grid_reference_level=0.,
axis_grid_reference_line_style='solid',
axis_grid_reference_thickness=1,
axis_grid_line_style='dash',
axis_title='on',
axis_title_text='Amount of rain',
axis_title_font='arial',
axis_title_height=0.5,
)
# Horizontal axis
horizontal = maxis(
axis_orientation='horizontal',
axis_type='date',
axis_tick_label_height=0.4,
axis_tick_label_colour='charcoal',
axis_grid='on',
axis_grid_colour='charcoal',
axis_grid_thickness=1,
axis_grid_line_style='dash',
)
dates = ["2012-10-27 00:00:00","2012-10-27 12:00:00","2012-10-28 00:00:00",
"2012-10-28 12:00:00","2012-10-29 00:00:00","2012-10-29 12:00:00",
"2012-10-30 00:00:00","2012-10-30 12:00:00",
"2012-10-31 00:00:00","2012-10-31 12:00:00",
"2012-11-01 00:00:00","2012-11-01 12:00:00",
"2012-11-02 00:00:00","2012-11-02 12:00:00"]
precip = [0.,0.1220703125,0.,0., 0., 3.16429138184,
2.18200683594,1.75476074219,0,0,0,0,0,0.]
#defining the data
data = minput(
input_x_type='date',
input_date_x_values= dates,
input_y2_values= precip,
input_y_values= [0.] * len(precip),
)
#defining the visualisation
bar = mgraph( legend='on' ,
graph_type ='bar',
graph_bar_line_colour = "navy",
graph_shade_colour = "evergreen",
legend_user_text= '<font colour ="evergreen" size="0.4"> Precipitation </font>',
graph_line_colour="navy",
graph_bar_width = 3600.00 *6,
graph_line_thickness= 3, )
#adding a title
title = mtext(
text_lines= ['Precipitation as Bar Plotting..', ],
text_html= 'true',
text_justification= 'left',
text_font_size= 0.8,
text_colour= 'charcoal',
)
plot(output, projection, vertical, horizontal, data, bar, title) |