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

Last change on this file since 1003 was 977, checked in by aslmd, 12 years ago

UTIL PYTHON planetoplot_v2. Added rainbow spahetti plot based on an idea by Alizee. Simply set a colormap for a 1D plot and you get it. Also added in pp_reload (simple rainbow function in ppplot). Added also xmin and xmax capabilitiy. Fixed various bugs related to dummy axis, logarithmic axes. Removed time_counter from set_ppclass.txt it is useless in most cases.

  • 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','--colorb',action='store',dest='colorb',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.colorb is not None:
37      yeah.colorb = opt.colorb
38      for plot in yeah.p:
39        plot.colorb = opt.colorb
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.colorb = cm
51         plot.title = cm
52       yeah.makeplot()
53    else:         
54      yeah.makeplot()
55
Note: See TracBrowser for help on using the repository browser.