Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section


Column
width60%


Panel

 mgraph ( macro/python ) pgraph ( fortran )


Graph plotting in Magics is the plotting of line charts (curves), bar charts, area charts and box plots within a set of axes.

There are facilities in graph plotting that allow the user to control the line style, colour and thickness of each graph and, if required, a legend describing the graph may be plotted.


Panel
titleNew in 2.31.0

The parameter graph_bar_orientation is now working. If set to 'horizontal', Magics will display horizontal bars..

Image Added

Code Block
languagepy
titlePython Code
collapsetrue
#importing Magics module
from Magics.macro import *


ref = 'bar_horizontal'
#Setting of the output file name
output = output(output_formats = ['png'], 
        output_name_first_page_number = "off",
        output_name = ref)

#Setting the cartesian view
projection = mmap( subpage_y_position= 2., 
            subpage_map_projection = 'cartesian',
            subpage_x_axis_type = 'regular',
            subpage_y_axis_type = 'regular',
            subpage_x_min = 10.,
            subpage_x_max = 40.,
            subpage_y_min = 25.,
            subpage_y_max = 75.)

#Vertical axis
vertical = maxis(axis_orientation = "vertical",
                 axis_type = "regular",
                 axis_tick_label_height = 0.4,
                 axis_tick_label_colour = 'navy',
                 axis_grid =  "on",
                 axis_grid_colour = "grey",
                 axis_grid_thickness = 1,
                 axis_grid_line_style = "dot")

#Horizontal axis
horizontal = maxis(axis_orientation = "horizontal",
                 axis_type = "regular",
                 axis_grid =  "on",
                 axis_grid_colour = "grey",
                 axis_grid_thickness = 1,
                 axis_grid_line_style = "dot")
#define  the  data 
x =  numpy.array([20.,30.,15.])
y = numpy.array([50.,30.,40.])

input = minput(input_y_values=y,
           input_x_values= x,)
#Define the graph 
graph = mgraph( 
            graph_type="bar",
            graph_bar_colour='evergreen',
            graph_bar_width=2.,
            graph_bar_orientation='horizontal')
title = mtext(
           text_lines = ["Simple Bar"],
           text_justification = "left",
           text_font_size = 1.,
           text_colour =  "charcoal")
#To the plot
plot(output, projection, vertical, horizontal, input, graph, title)




Column
width30%


Panel
titleQuick links :

Import data:

Gallery:

 

 



...

HTML
<div id="magics">	
</div>

<script src="/wiki/download/attachments/13207038/magdoc_ajs.js"></script>
<link rel="stylesheet" type="text/css" href="/wiki/download/attachments/13207038/magics.css" />
<link rel="stylesheet" type="text/css" href="/wiki/download/attachments/13207038/jquery.miniColors.css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="/wiki/download/attachments/13207038/jquery.miniColors.js"></script>

 <script>
	load("/wiki/download/attachments/14157274/graph.json");
</script>


...