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
RevLine 
[910]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
[977]9from ppplot import rainbow
[910]10# -----------------------------------------------------------------------
11parser = OptionParser()
[917]12parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format')
[933]13parser.add_option('-T','--title',action='store',dest='title',type="string",default=None,help='Give a new title')
[923]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")
[942]17parser.add_option('-E','--explore',action='store_true',dest='explore',default=False,help="[2D] Try many colormaps")
[910]18(opt,args) = parser.parse_args()
19# -----------------------------------------------------------------------
[942]20clb = ["Greys","Blues","YlOrRd",\
21       "jet","spectral","hot",\
22       "RdBu","RdYlBu","Paired",\
23       "gist_ncar","gist_rainbow","gist_stern"]
24# -----------------------------------------------------------------------
25
[910]26for files in args:
[942]27
[910]28    yeah = pp()
[960]29    yeah.quiet = True
[910]30    yeah.defineplot(loadfile=files)
31    yeah.out = opt.out
[942]32
[917]33    if opt.proj is not None:
34      for plot in yeah.p:
35        plot.proj = opt.proj
[923]36    if opt.colorb is not None:
[977]37      yeah.colorb = opt.colorb
[923]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
[933]43    if opt.title is not None:
44      for plot in yeah.p:
45        plot.title = opt.title
[910]46
[942]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.