Skip to content

Commit 49e2703

Browse files
committed
add min and max data limits
1 parent fb6adee commit 49e2703

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

analysis/plotcompact.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88

99
# plot an output file using the solver's dovis script
10-
def makeplot(plotfile, variable, outfile):
10+
11+
def makeplot(plotfile, variable, outfile, vmin=None, vmax=None):
1112

1213
sim = io.read(plotfile)
1314
myd = sim.cc_data
@@ -28,11 +29,18 @@ def makeplot(plotfile, variable, outfile):
2829
else:
2930
v = myd.get_var(variable)
3031

32+
if vmin is None:
33+
vmin = v.v().min()
34+
35+
if vmax is None:
36+
vmax = v.v().max()
37+
3138
plt.figure(num=1, figsize=(6.0, 6.0), dpi=100, facecolor='w')
3239

3340
plt.imshow(np.transpose(v[myg.ilo:myg.ihi+1, myg.jlo:myg.jhi+1]),
3441
interpolation="nearest", origin="lower",
35-
extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax])
42+
extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax],
43+
vmin=vmin, vmax=vmax)
3644

3745
plt.axis("off")
3846
plt.subplots_adjust(bottom=0.0, top=1.0, left=0.0, right=1.0)
@@ -45,6 +53,10 @@ def get_args():
4553

4654
parser.add_argument("-o", type=str, default="plot.png",
4755
metavar="plot.png", help="output file name")
56+
parser.add_argument("-m", type=float, default=None,
57+
metavar="data-min", help="minimum data value to show")
58+
parser.add_argument("-M", type=float, default=None,
59+
metavar="data-max", help="maximum data value to show")
4860
parser.add_argument("plotfile", type=str, nargs=1,
4961
help="the plotfile you wish to plot")
5062
parser.add_argument("variable", type=str, nargs=1,
@@ -59,4 +71,4 @@ def get_args():
5971

6072
args = get_args()
6173

62-
makeplot(args.plotfile[0], args.variable[0], args.o)
74+
makeplot(args.plotfile[0], args.variable[0], args.o, vmin=args.m, vmax=args.M)

0 commit comments

Comments
 (0)