Ejemplo n.º 1
0
# Let's set the colors
x.Graph[0].Set[0].line.color = 'red'
x.Graph[0].Set[1].line.color = 4  # color 4 is blue
# Let's set the second's set style to dash
x.Graph[1].Set[0].line.linestyle = 'dot'
x.Graph[0].Set[1].line.linestyle = 'dash'
x.Graph[0].Set[0].line.linestyle = 2  # 2 is dash

# Now let's set the name for each set, to be used in the legend
x.Graph[0].Set[0].legend = 'Year 1'
x.Graph[0].Set[1].legend = 'Year 2'
x.Graph[1].Set[0].legend = 'Year 2-1'
# ok one last trick, in order to have the 0 line plotted
# let's create a dummy array with zeros in it:
zero = MV.zeros((2), MV.Float)
zero = MV.asVariable(zero)
zero.setdimattribute(0, 'values', [-1., 1.])
# add a dataset and assign it graph 1 black color
x.add_set(1, 'black')

# Finally just for fun let's place a big red "Sample" accross it
x.add_string(0.5, 0.5, 'Sample', color='red', char_size=9, rot=55, just=14)

# And plot these babies:
x.plot([z1, z2, z3,
        zero])  # You MUST pass a list of slab, even if only one slab
# or you can plot then 1 by 1
# first let's clear
x('kill G0.S0')
x('kill G0.S1')
x('kill G1.S0')
Ejemplo n.º 2
0
# Let's set the colors
x.Graph[0].Set[0].line.color = 'red'
x.Graph[0].Set[1].line.color = 4  # color 4 is blue
# Let's set the second's set style to dash
x.Graph[1].Set[0].line.linestyle = 'dot'
x.Graph[0].Set[1].line.linestyle = 'dash'
x.Graph[0].Set[0].line.linestyle = 2  # 2 is dash

# Now let's set the name for each set, to be used in the legend
x.Graph[0].Set[0].legend = 'Year 1'
x.Graph[0].Set[1].legend = 'Year 2'
x.Graph[1].Set[0].legend = 'Year 2-1'
# ok one last trick, in order to have the 0 line plotted
# let's create a dummy array with zeros in it:
zero = MV.zeros((2), MV.Float)
zero = MV.asVariable(zero)
zero.setdimattribute(0, 'values', [-1., 1.])
# add a dataset and assign it graph 1 black color
x.add_set(1, 'black')

# Finally just for fun let's place a big red "Sample" accross it
x.add_string(0.5, 0.5, 'Sample', color='red', char_size=9, rot=55, just=14)

# And plot these babies:
# You MUST pass a list of slab, even if only one slab
x.plot([z1, z2, z3, zero])
# or you can plot then 1 by 1
# first let's clear
x('kill G0.S0')
x('kill G0.S1')
x('kill G1.S0')