~ubuntu-branches/ubuntu/saucy/python-scipy/saucy

« back to all changes in this revision

Viewing changes to Lib/sandbox/xplt/graftest2d.py

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
## Automatically adapted for scipy Oct 31, 2005 by
2
 
 
3
 
# Copyright (c) 1996, 1997, The Regents of the University of California.
4
 
# All rights reserved.  See Legal.htm for full text and disclaimer.
5
 
 
6
 
from scipy import *
7
 
from numpy.core.umath import *
8
 
GraphicsError = "GraphicsError"
9
 
import os
10
 
try:
11
 
    graphics = os.environ["PYGRAPH"]
12
 
except KeyError:
13
 
    graphics = "Gist"
14
 
 
15
 
if graphics [0:3] == "Nar" :
16
 
    import NarPlotter
17
 
elif graphics == "Gist" :
18
 
    import GistPlotter
19
 
else :
20
 
    raise GraphicsError , \
21
 
       graphics + " is an unknown graphics package. Check PYGRAPH " + \
22
 
          "environment variable."
23
 
 
24
 
from curve import Curve
25
 
from graph2d import *
26
 
def paws ( ) :
27
 
    i = raw_input ("Type in any string to continue; ^C to return to prompt. ")
28
 
    return
29
 
 
30
 
if graphics [0:3] == "Nar" :
31
 
    print "This is a test of the Python interface to the Limeil Lab graphics"
32
 
    print "package, Narcisse. You  need Narcisse to be running. Fire it up by"
33
 
    print "typing /dist/basis/Narcisse/bin/Narcisse."
34
 
elif graphics == "Gist" :
35
 
    print "This is a test of the Python interface to the Gist graphics package."
36
 
 
37
 
paws ()
38
 
 
39
 
vsf = 0.
40
 
c = 1
41
 
s = 1000.
42
 
kmax = 25
43
 
lmax = 35
44
 
 
45
 
c1 = Curve ( y = arange (1, kmax+1, dtype = Float) , color = "yellow" )
46
 
g2 = Graph2d ( c1 , titles = ["Bottom of the Barrel", "Top Dog",
47
 
                              "Leftist", "Reaganist"] )
48
 
g2.plot ( )
49
 
paws ( )
50
 
c2 = Curve ( y = sqrt (arange (1, kmax+1, dtype = Float)**3) ,
51
 
   color = "blue")
52
 
g2.add ( c2 )
53
 
g2.plot ( )
54
 
paws ( )
55
 
c1.set (marks = 1, marker = "A")
56
 
c2.set (marks = 1, marker = "B")
57
 
g2.plot ( )
58
 
paws ( )
59
 
c1.set (marks = 0)
60
 
c2.set (marks = 0)
61
 
c1.set (width = 3.0)
62
 
c2.set (width = 4.0)
63
 
g2.plot ( )
64
 
paws ( )
65
 
c1.set (type = "dash")
66
 
c2.set (type = "dashdot")
67
 
g2.plot ( )
68
 
paws ( )
69
 
g2.delete ( 1 )
70
 
g2.plot ( )
71
 
paws ( )
72
 
mycolor= ["red", "blue", "yellow", "green", "orange", "purple"]
73
 
markers= ["+", "*", "o", "x", "."]
74
 
c5 = [ ]
75
 
for i in range (len (markers)) :
76
 
    c5.append ( Curve (
77
 
       y = exp (array (multiply ((1.0+(i+1)/10.), log (range (1, kmax))))) ,
78
 
                color = mycolor [i] , marks = 1, marker = markers [i] ,
79
 
                type = "none" )
80
 
              )
81
 
g2.new ( c5 , text="Line style and grid test" , text_color="black" ,
82
 
          text_pos = array ( [.2, .8]) , text_size = 60 ,
83
 
          titles = "Figure 1", old_plotter = 1)
84
 
g2.plot ( )
85
 
paws ( )
86
 
g2.quick_plot ( grid_type = "wide" )
87
 
paws ( )
88
 
part1 = abs (array ( [-5, -4, -3, -2, -1, .0000000001] ) )
89
 
c1.new (  y = part1, x = arange (-5, 1, dtype = Float) ,
90
 
         type="line" , color = "blue" )
91
 
part2 = array ( [.0000000001, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )
92
 
c2.new ( y = part2 , x = arange (0, 11, dtype = Float) ,
93
 
         type = "line" , color = "blue" )
94
 
g2.new ( [c1, c2] , text = " " , axis_scales = "linlog" , titles = " " ,
95
 
          axis_limits = array ( [[-6., 10.], [1.e-6, 10.]]), old_plotter = 1)
96
 
g2.plot ( )
97
 
paws ( )
98
 
c1.new ( y = array (exp (multiply (log (10.0), range (-50, 1)))) ,
99
 
         x = arange (1, 52, dtype = Float) )
100
 
g2.new ( c1 , axis_scales = "loglog" ,
101
 
              axis_limits = array ( [[1., 100.], [1.e-8, 1.]]), old_plotter = 1)
102
 
g2.plot ( )
103
 
paws ( )
104
 
c1.new ( y = array ( [1.e-48, 1.e-21, 0., 0., 0.]) )
105
 
g2.new ( c1 , axis_scales = "linlin" ,
106
 
              axis_limits = array  ( [[0., 0.], [0., 0.]]), old_plotter = 1)
107
 
g2.plot ( )