source: trunk/UTIL/PYTHON/planetoplot_v2/pp_reload.py @ 1170

Last change on this file since 1170 was 1050, checked in by aslmd, 11 years ago

UTIL PYTHON planetoplot_v2

RENAMED VARIABLES TO BE SIMPLER or COMPLIANT WITH MATPLOTLIB

colorb >> colorbar
lstyle >> linestyle
label >> legend

stridevecx >> svx
stridevecy >> svy
stridex >> sx
stridey >> sy
stridez >> sz
stridet >> st

(in ppplot only)
field >> f
absc >> x
ordi >> y
addvecx >> vx
addvecy >> vy
addontour >> c

ALSO added (same reason of compatibility)

  • the possibility to call ppplot.show() as in matplotlib
  • a shortcut method for a ppplot object: the so-called .makeshow()
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#! /usr/bin/env python
2# -----------------------------------------------------------------------
3# A very simple script to reload a previously saved plot array in ppclass
4# ... for a demo, try "pp_reload.py demo_data/*"
5# Author: A. Spiga 03/2013
6# -----------------------------------------------------------------------
7from optparse import OptionParser ### TBR by argparse
8from ppclass import pp
9from ppplot import rainbow
10# -----------------------------------------------------------------------
11parser = OptionParser()
12parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format')
13parser.add_option('-T','--title',action='store',dest='title',type="string",default=None,help='Give a new title')
14parser.add_option('-K','--marker',action='store',dest='marker',type="string",default=None,help="[1D] Define a new marker")
15parser.add_option('-P','--proj',action='store',dest='proj',type="string",default=None,help='[2D] Define a new map projection')
16parser.add_option('-C','--colorbar',action='store',dest='colorbar',type="string",default=None,help="[2D] Define a new colormap")
17parser.add_option('-E','--explore',action='store_true',dest='explore',default=False,help="[2D] Try many colormaps")
18(opt,args) = parser.parse_args()
19# -----------------------------------------------------------------------
20clb = ["Greys","Blues","YlOrRd",\
21       "jet","spectral","hot",\
22       "RdBu","RdYlBu","Paired",\
23       "gist_ncar","gist_rainbow","gist_stern"]
24# -----------------------------------------------------------------------
25
26for files in args:
27
28    yeah = pp()
29    yeah.quiet = True
30    yeah.defineplot(loadfile=files)
31    yeah.out = opt.out
32
33    if opt.proj is not None:
34      for plot in yeah.p:
35        plot.proj = opt.proj
36    if opt.colorbar is not None:
37      yeah.colorbar = opt.colorbar
38      for plot in yeah.p:
39        plot.colorbar = opt.colorbar
40    if opt.marker is not None:
41      for plot in yeah.p:
42        plot.marker = opt.marker
43    if opt.title is not None:
44      for plot in yeah.p:
45        plot.title = opt.title
46
47    if opt.explore:
48      for cm in clb:
49       for plot in yeah.p:
50         plot.colorbar = cm
51         plot.title = cm
52       yeah.makeplot()
53    else:         
54      yeah.makeplot()
55
Note: See TracBrowser for help on using the repository browser.