-
Notifications
You must be signed in to change notification settings - Fork 7
/
ClawPlotItem.html
684 lines (625 loc) · 39.6 KB
/
ClawPlotItem.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>ClawPlotItem — Clawpack 5.11.x documentation</title>
<link rel="stylesheet" href="_static/base.css" type="text/css" />
<link rel="stylesheet" href="_static/layout.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/flasky.css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="shortcut icon" href="_static/clawicon.ico"/>
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="current_data" href="current_data.html" />
<link rel="prev" title="ClawPlotAxes" href="ClawPlotAxes.html" />
</head><body>
<div id="main-wrapper" class="sphinx">
<div id="header-wrapper">
<section id="header">
<!-- <h1><a href="http://clawpack.org/">Clawpack</a></h1> -->
<h1><a href="http://clawpack.org/">Clawpack-5</a></h1>
<nav>
<ul>
<li>
<a href="contents.html">Docs</a>
</li>
<li>
<a href="installing.html">Install</a>
</li>
<li>
<a class="" href="http://clawpack.org/gallery/index.html">Gallery</a>
</li>
<li>
<a href="about.html">Citation</a>
</li>
<li>
<a class="active" href="http://github.com/clawpack">GitHub</a>
</li>
<li>
<a class="" href="community.html">Community</a>
</li>
<li>
<a class="" href="developers.html">Contribute</a>
</li>
</ul>
</nav>
</section>
<div class="decoration"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="current_data.html" title="current_data"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ClawPlotAxes.html" title="ClawPlotAxes"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="contents.html">Clawpack 5.11.x documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="plotting.html" >Plotting with Visclaw</a> »</li>
<li class="nav-item nav-item-2"><a href="setplot.html" accesskey="U">Using setplot.py to specify the desired plots</a> »</li>
<li class="nav-item nav-item-this"><a href="">ClawPlotItem</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="clawplotitem">
<span id="id1"></span><h1>ClawPlotItem<a class="headerlink" href="#clawplotitem" title="Permalink to this heading">¶</a></h1>
<p>For usage see <a class="reference internal" href="setplot.html#setplot"><span class="std std-ref">Using setplot.py to specify the desired plots</span></a> and <a class="reference internal" href="plotexamples.html#plotexamples"><span class="std std-ref">Plotting examples</span></a>.</p>
<p>Objects of this class are usually created by the new_plotitem method of a
<a class="reference internal" href="ClawPlotAxes.html#clawplotaxes"><span class="std std-ref">ClawPlotAxes</span></a> object.</p>
<p>The examples shown below are fragments of a typical <em>setplot</em>
function which assume <em>plotaxes</em> is an instance of <a class="reference internal" href="ClawPlotAxes.html#clawplotaxes"><span class="std std-ref">ClawPlotAxes</span></a>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="setplot.html#setplot"><span class="std std-ref">Using setplot.py to specify the desired plots</span></a> and <a class="reference internal" href="plotexamples.html#plotexamples"><span class="std std-ref">Plotting examples</span></a></p>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="plotexamples.html#plotexamples"><span class="std std-ref">Plotting examples</span></a></p>
</div>
<dl class="py class">
<dt class="sig sig-object py" id="ClawPlotItem">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ClawPlotItem</span></span><a class="headerlink" href="#ClawPlotItem" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<section id="attributes">
<h2>Attributes<a class="headerlink" href="#attributes" title="Permalink to this heading">¶</a></h2>
<p>The following attributes can be set by the user:</p>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">plot_type</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd><p>Type of plot desired, one of the following:</p>
<ul class="simple">
<li><p>‘1d_plot’ : one dimensional line or set of points plotted using the
matplotlib plot command.</p></li>
<li><p>‘1d_from_2d_data’ : 1d plot generated from 2d data, for example as a
slice of the data or a scatter plot of data that should be radially
symmetric,</p></li>
<li><p>‘1d_fill_between’ : 1d filled plot between two variable specified by
the attributes <em>plot_var</em> and <em>fill_var2</em>.</p></li>
<li><p>‘2d_imshow’ : two dimentional raster plot</p></li>
<li><p>‘2d_contour’ : two dimensional contour plot,</p></li>
<li><p>‘2d_pcolor’ : two dimensional pcolor plot,</p></li>
<li><p>‘2d_schlieren’ : two dimensional Schlieren plot,</p></li>
<li><p>‘2d_patch’ : two dimensional plot of only the cell and/or patch edges, no data</p></li>
<li><p>‘2d_hillshade’ : two dimensional hillshade plot.</p></li>
</ul>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">outdir</span> <span class="pre">:</span> <span class="pre">str</span> <span class="pre">or</span> <span class="pre">None</span></span></dt>
<dd><p>Directory to find data to be plotted.
If None, then data comes from the outdir attribute of the parent
ClawPlotData item.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">plot_var</span> <span class="pre">:</span> <span class="pre">int</span> <span class="pre">or</span> <span class="pre">function</span></span></dt>
<dd><p>If an integer, then this specifies which component of q to plot (with
the Python convention that plot_var=0 corresponds to the first
component).</p>
<p>If a function, then this function is applied to q on each patch to
compute the variable var that is plotted. The signature is</p>
<ul class="simple">
<li><p>var = plot_var(current_data)</p></li>
</ul>
<p>The <a class="reference internal" href="current_data.html#current-data"><span class="std std-ref">current_data</span></a> object holds data from the current frame that can be
used to compute the variable to be plotted.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">afteritem</span> <span class="pre">:</span> <span class="pre">str</span> <span class="pre">or</span> <span class="pre">function</span> <span class="pre">or</span> <span class="pre">None</span></span></dt>
<dd><p>A string or function that is to be executed after plotting this item.
If a string, this string is executed using <em>exec</em>. If a
function, it should be defined to have a single argument
<a class="reference internal" href="current_data.html#current-data"><span class="std std-ref">current_data</span></a>.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">afteritem</span><span class="p">(</span><span class="n">current_data</span><span class="p">):</span>
</pre></div>
</div>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">afterpatch</span> <span class="pre">:</span> <span class="pre">str</span> <span class="pre">or</span> <span class="pre">function</span> <span class="pre">or</span> <span class="pre">None</span></span></dt>
<dd><p>A string or function that is to be executed after plotting this item on
each patch. (There may be more than 1 patch in an AMR calculation.)
If a string, this string is executed using <em>exec</em>. If a
function, it should be defined to have a single argument
“data”, [documentation to appear!]</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">afterpatch</span><span class="p">(</span><span class="n">current_data</span><span class="p">):</span>
<span class="n">cd</span> <span class="o">=</span> <span class="n">current_data</span>
<span class="nb">print</span> <span class="s2">"On patch number </span><span class="si">%s</span><span class="s2">, xlower = </span><span class="si">%s</span><span class="s2">, ylower = </span><span class="si">%s</span><span class="s2">"</span> \
<span class="o">%</span> <span class="p">(</span><span class="n">cd</span><span class="o">.</span><span class="n">patchno</span><span class="p">,</span> <span class="n">cd</span><span class="o">.</span><span class="n">xlower</span><span class="p">,</span> <span class="n">cd</span><span class="o">.</span><span class="n">ylower</span><span class="p">)</span>
</pre></div>
</div>
<p>would print out the patch number and lower left corner for each patch in
a 2d computation after the patch is plotted.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">MappedGrid</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, the mapping specified by the <em>mapc2p</em> attribute of the
underlying <cite>ClawPlotData</cite> object should be applied to the patch before
plotting.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">show</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If False, plotting of this object is suppressed.</p>
</dd></dl>
<p><strong>The other attributes required depend on the plot_type, as summarized
below:</strong></p>
<section id="special-attributes-for-all-1d-plots-plot-type-1d">
<h3>Special attributes for all 1d plots, plot_type = ‘1d…’<a class="headerlink" href="#special-attributes-for-all-1d-plots-plot-type-1d" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">plotstyle</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd><p>Anything that is valid as a fmt
group in the <a class="reference external" href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot">matplotlib plot command</a>.
For example:</p>
<ul class="simple">
<li><p>‘-’ for a solid line, ‘- -’ for a dashed line,</p></li>
<li><p>‘o’ for circles, ‘x’ for x’s, ‘-o’ for circles and a line,</p></li>
<li><p>‘bo’ for blue circles (though if the <em>color</em> attribute is also set
that will overrule the color in the format string).</p></li>
</ul>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">color</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd><p>Any matplotlib color, for example red can be specified as ‘r’ or ‘red’
or ‘[1,0,0]’ or ‘#ff0000’.</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-1d-plot">
<h3>Special attributes for plot_type = ‘1d_plot’<a class="headerlink" href="#special-attributes-for-plot-type-1d-plot" title="Permalink to this heading">¶</a></h3>
<p>No extra attributes.</p>
</section>
<section id="special-attributes-for-plot-type-1d-fill-between">
<h3>Special attributes for plot_type = ‘1d_fill_between’<a class="headerlink" href="#special-attributes-for-plot-type-1d-fill-between" title="Permalink to this heading">¶</a></h3>
<p>This gives a filled polygon between two curves using the <a class="reference external" href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.fill_between">matplotlib
fill_between command</a>.</p>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">plot_var</span> <span class="pre">:</span> <span class="pre">int</span> <span class="pre">or</span> <span class="pre">function</span></span></dt>
<dd><p>as described above defines one curve,</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">plot_var2</span> <span class="pre">:</span> <span class="pre">int</span> <span class="pre">or</span> <span class="pre">function</span></span></dt>
<dd><p>defines the second curve for the fill_between command.
Default is the zero function.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">fill_where</span> <span class="pre">:</span> <span class="pre">str</span> <span class="pre">or</span> <span class="pre">None</span></span></dt>
<dd><blockquote>
<div><p>defines the <em>where</em> attribute of the fill_between command.</p>
</div></blockquote>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">plotitem</span> <span class="o">=</span> <span class="n">plotaxes</span><span class="o">.</span><span class="n">new_plotitem</span><span class="p">(</span><span class="n">plot_type</span><span class="o">=</span><span class="s1">'1d_fill_between'</span><span class="p">)</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">plot_var</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># means use q[:,0]</span>
</pre></div>
</div>
<p>would produce a filled curve between y=q[:,0] and y=0.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">plotitem</span> <span class="o">=</span> <span class="n">plotaxes</span><span class="o">.</span><span class="n">new_plotitem</span><span class="p">(</span><span class="n">plot_type</span><span class="o">=</span><span class="s1">'1d_fill_between'</span><span class="p">)</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">plot_var</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># means use q[:,0]</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">plot_var2</span> <span class="o">=</span> <span class="mi">1</span>
</pre></div>
</div>
<p>would produce a filled curve between y=q[:,0] and y=q[:,1].</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-1d-from-2d-data">
<span id="d-from-2d-data"></span><h3>Special attributes for plot_type = ‘1d_from_2d_data’<a class="headerlink" href="#special-attributes-for-plot-type-1d-from-2d-data" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">map_2d_to_1d</span> <span class="pre">:</span> <span class="pre">function</span></span></dt>
<dd><p>Example: In a 2d computation where the solution q[:,:,0] should be
radially symmetric about (x,y)=(0,0), the following will result in a
scatter plot of the cell values q[i,j,0] vs. the radius r(i,j):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">q0_vs_radius</span><span class="p">(</span><span class="n">current_data</span><span class="p">):</span>
<span class="c1"># convert 2d (x,y,q) into (r,q) for scatter plot</span>
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">sqrt</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">current_data</span><span class="o">.</span><span class="n">x</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">current_data</span><span class="o">.</span><span class="n">y</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="n">q0</span> <span class="o">=</span> <span class="n">current_data</span><span class="o">.</span><span class="n">var</span> <span class="c1"># the variable specified by plot_var</span>
<span class="c1"># q0 = current_data.q[:,:,0] # would also work</span>
<span class="k">return</span> <span class="n">r</span><span class="p">,</span><span class="n">q0</span>
<span class="n">plotitem</span> <span class="o">=</span> <span class="n">plotaxes</span><span class="o">.</span><span class="n">new_plotitem</span><span class="p">(</span><span class="n">plot_type</span><span class="o">=</span><span class="s1">'1d_from_2d_data'</span><span class="p">)</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">plot_var</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># use q[:,:,0]</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">plotstyle</span> <span class="o">=</span> <span class="s1">'o'</span> <span class="c1"># symbol not line is best for scatter plot</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">map_2d_to_1d</span> <span class="o">=</span> <span class="n">q0_vs_radius</span> <span class="c1"># the function defined above</span>
</pre></div>
</div>
<p>See <a class="reference internal" href="current_data.html#current-data"><span class="std std-ref">current_data</span></a> for a description of the <em>current_data</em> argument.</p>
</dd></dl>
</section>
<section id="special-attributes-for-all-2d-plots-plot-type-2d">
<h3>Special attributes for all 2d plots, plot_type = ‘2d…’<a class="headerlink" href="#special-attributes-for-all-2d-plots-plot-type-2d" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">celledges_show</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, draw the cell edges on the plot.
The attribute ‘amr_celledges_show’ should be used for AMR computations
to specify that cell edges should be shown on some levels and not
others. See <a class="reference internal" href="#amr-attributes"><span class="std std-ref">AMR Attributes</span></a>.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">patchedges_show</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, draw the edges of patches, mostly useful in AMR computations.</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-2d-contour">
<h3>Special attributes for plot_type = ‘2d_contour’<a class="headerlink" href="#special-attributes-for-plot-type-2d-contour" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_levels</span> <span class="pre">:</span> <span class="pre">numpy</span> <span class="pre">array</span> <span class="pre">or</span> <span class="pre">None</span></span></dt>
<dd><p>If a numpy array, the contour levels. If None, then the next three
attributes are used to set the levels.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_nlevels</span> <span class="pre">:</span> <span class="pre">int</span></span></dt>
<dd><p>Number of contour levels</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_min</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>Minimum contour level</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_max</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>Maximum contour level</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_colors</span> <span class="pre">:</span> <span class="pre">color</span> <span class="pre">specification</span></span></dt>
<dd><p>Colors of contour lines. Can be a single color such as ‘b’ or
‘#0000ff’, or a colormap.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">amr_contour_colors</span> <span class="pre">:</span> <span class="pre">list</span> <span class="pre">of</span> <span class="pre">color</span> <span class="pre">specifications</span></span></dt>
<dd><p>As with other attributes (see <a class="reference internal" href="#amr-attributes"><span class="std std-ref">AMR Attributes</span></a> below),
instead of contour_colors you can specify
<em>amr_contour_colors</em>
to be a list of colors (or colormaps) to use on each AMR level, e.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">amr_contour_colors</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'k'</span><span class="p">,</span><span class="s1">'b'</span><span class="p">,</span><span class="s1">'r'</span><span class="p">]</span>
</pre></div>
</div>
<p>to use black lines on Level 1, blue on Level 2, and red for all
subsequent levels. This is useful since with the matplotlib contour
plotter you will see both fine and coarse cell edges on top of one
another in refined regions (Matplotlib lacks the required
hidden line removal to blank out the lines from coarser patches easily.
See also the next attributes.)</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_show</span> <span class="pre">:</span> <span class="pre">boolean</span></span></dt>
<dd><p>Show the contour lines only if this attribute is true. This is most
commonly used in the form of the next attribute,</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">amr_contour_show</span> <span class="pre">:</span> <span class="pre">list</span> <span class="pre">or</span> <span class="pre">tuple</span> <span class="pre">of</span> <span class="pre">booleans</span></span></dt>
<dd><p>Determines whether to show the contour lines on each AMR level. Useful
if you only want to view the lines on the finest patches.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">contour_kwargs</span> <span class="pre">:</span> <span class="pre">dictionary</span></span></dt>
<dd><p>Other keyword arguments for the contour command.</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-2d-pcolor">
<h3>Special attributes for plot_type = ‘2d_pcolor’<a class="headerlink" href="#special-attributes-for-plot-type-2d-pcolor" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">pcolor_cmap</span> <span class="pre">:</span> <span class="pre">matplotlib</span> <span class="pre">colormap</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">pcolor_cmin</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">pcolor_cmax</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>In general you should specify <em>pcolor_cmin</em> and <em>pcolor_cmax</em> to
specify the range of q values over which the colormap applies. If they
are not specified they will be chosen automatically and may vary from
frame to frame. Also, if AMR is used, they may vary from patch to patch,
yielding very confusing plots.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">add_colorbar</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, a colorbar is added to the plot.</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-2d-imshow">
<h3>Special attributes for plot_type = ‘2d_imshow’<a class="headerlink" href="#special-attributes-for-plot-type-2d-imshow" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">imshow_cmap</span> <span class="pre">:</span> <span class="pre">matplotlib</span> <span class="pre">colormap</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">imshow_cmin</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">imshow_cmax</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>In general you should specify <em>imshow_cmin</em> and <em>imshow_cmax</em> to
specify the range of q values over which the colormap applies. If they
are not specified they will be chosen automatically and may vary from
frame to frame. Also, if AMR is used, they may vary from patch to patch,
yielding very confusing plots.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">add_colorbar</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, a colorbar is added to the plot.</p>
</dd></dl>
</section>
<section id="special-attributes-for-plot-type-2d-hillshade">
<h3>Special attributes for plot_type = ‘2d_hillshade’<a class="headerlink" href="#special-attributes-for-plot-type-2d-hillshade" title="Permalink to this heading">¶</a></h3>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">hillshade_vertical_exaggeration</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>Vertical exaggeration for hillshade calulation. Default of 1.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">hillshade_azimuth_degree</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>Light source azimuth angle for hillshade calculation. Default
is 315 (light coming from the northwest). Valid values are
0-360 degrees clockwise from North. The default value is recommended
for proper interpretation by most people.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">hillshade_altitude_degree</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd><p>Light source altitude angle from the horizon for hillshade
calculation. Default is 45. Valid values are 0-90.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">hillshade_latlon</span> <span class="pre">:</span> <span class="pre">bool</span></span></dt>
<dd><p>If True, correct the ratio between x and y units and z units
by 1/111200 to reflect that x and y units are degrees.
Default is False.</p>
</dd></dl>
</section>
</section>
<section id="amr-attributes">
<span id="id2"></span><h2>AMR Attributes<a class="headerlink" href="#amr-attributes" title="Permalink to this heading">¶</a></h2>
<p>Many attributes listed above also have a second related attribute with the
same name pre-pended with <em>amr_</em>. If this attribute is set, it should be a
list whose elements are of the type specified by the original name, and the
elements of the list will be used for different AMR refinement levels.</p>
<p>For example, the following commands:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">plotitem</span> <span class="o">=</span> <span class="n">plotaxes</span><span class="o">.</span><span class="n">new_plotitem</span><span class="p">(</span><span class="n">plot_type</span><span class="o">=</span><span class="s1">'2d_contour'</span><span class="p">)</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">contour_color</span> <span class="o">=</span> <span class="s1">'r'</span>
</pre></div>
</div>
<p>will result in all contour lines being red on all levels of AMR. On the
other hand:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">plotitem</span> <span class="o">=</span> <span class="n">plotaxes</span><span class="o">.</span><span class="n">new_plotitem</span><span class="p">(</span><span class="n">plot_type</span><span class="o">=</span><span class="s1">'2d_contour'</span><span class="p">)</span>
<span class="n">plotitem</span><span class="o">.</span><span class="n">amr_contour_color</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'k'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">]</span>
</pre></div>
</div>
<p>will result in contour lines on patches at level 1 being black and on
patches of level 2 or higher being blue.</p>
<p>Note that if the list is shorter than the number of levels, the last element
is used repeatedly.</p>
<p>If both attributes <em>contour_color</em> and <em>amr_contour_color</em> are set,
only <em>amr_contour_color</em> is used.</p>
<p>A common use is to show cell edges only on coarse levels, not on finer
levels, e.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">plotitem</span><span class="o">.</span><span class="n">amr_celledges_show</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
</pre></div>
</div>
<p>will result in celledges being shown only on levels 1 and 2, not on finer
levels.</p>
</section>
<section id="colorbar-attributes">
<h2>Colorbar attributes<a class="headerlink" href="#colorbar-attributes" title="Permalink to this heading">¶</a></h2>
<p>If <cite>add_colorbar == True</cite>, then the following attributes are also used
(see the <a class="reference external" href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.colorbar.html">matplotlib colorbar documentation</a>
for descriptions and note that other kwargs can also be specified in a
dictionary):</p>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_shrink</span> <span class="pre">:</span> <span class="pre">float</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_label</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_ticks</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_tick_labels</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_extend</span> <span class="pre">:</span> <span class="pre">str</span></span></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">colorbar_kwargs</span> <span class="pre">:</span> <span class="pre">dictionary</span></span></dt>
<dd><p>Other kwargs to be passed to <cite>colorbar</cite>.</p>
</dd></dl>
</section>
<section id="methods">
<h2>Methods<a class="headerlink" href="#methods" title="Permalink to this heading">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="getframe">
<span class="sig-name descname"><span class="pre">getframe</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">frameno</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#getframe" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an object of class <a class="reference internal" href="pyclaw/solution.html#solution"><span class="std std-ref">pyclaw.solution.Solution</span></a>
containing the solution being
plotted by this object for frame number frameno.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="gethandle">
<span class="sig-name descname"><span class="pre">gethandle</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gethandle" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the handle for this item.</p>
</dd></dl>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p><a href="http://clawpack.org/">
<img class="logo" src= "_static/clawlogo.jpg" alt="Logo"/>
</a>
<h2>Version 5.11.x</h2>
</p>
<div>
<h3><a href="contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">ClawPlotItem</a><ul>
<li><a class="reference internal" href="#ClawPlotItem"><code class="docutils literal notranslate"><span class="pre">ClawPlotItem</span></code></a></li>
<li><a class="reference internal" href="#attributes">Attributes</a><ul>
<li><a class="reference internal" href="#special-attributes-for-all-1d-plots-plot-type-1d">Special attributes for all 1d plots, plot_type = ‘1d…’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-1d-plot">Special attributes for plot_type = ‘1d_plot’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-1d-fill-between">Special attributes for plot_type = ‘1d_fill_between’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-1d-from-2d-data">Special attributes for plot_type = ‘1d_from_2d_data’</a></li>
<li><a class="reference internal" href="#special-attributes-for-all-2d-plots-plot-type-2d">Special attributes for all 2d plots, plot_type = ‘2d…’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-2d-contour">Special attributes for plot_type = ‘2d_contour’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-2d-pcolor">Special attributes for plot_type = ‘2d_pcolor’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-2d-imshow">Special attributes for plot_type = ‘2d_imshow’</a></li>
<li><a class="reference internal" href="#special-attributes-for-plot-type-2d-hillshade">Special attributes for plot_type = ‘2d_hillshade’</a></li>
</ul>
</li>
<li><a class="reference internal" href="#amr-attributes">AMR Attributes</a></li>
<li><a class="reference internal" href="#colorbar-attributes">Colorbar attributes</a></li>
<li><a class="reference internal" href="#methods">Methods</a><ul>
<li><a class="reference internal" href="#getframe"><code class="docutils literal notranslate"><span class="pre">getframe()</span></code></a></li>
<li><a class="reference internal" href="#gethandle"><code class="docutils literal notranslate"><span class="pre">gethandle()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div><h3>Related Topics</h3>
<ul>
<li><a href="contents.html">Documentation overview</a><ul>
<li><a href="plotting.html">Plotting with Visclaw</a><ul>
<li><a href="setplot.html">Using setplot.py to specify the desired plots</a><ul>
<li>Previous: <a href="ClawPlotAxes.html" title="previous chapter">ClawPlotAxes</a></li>
<li>Next: <a href="current_data.html" title="next chapter">current_data</a></li>
</ul></li>
</ul></li>
</ul></li>
</ul>
<div class="widget navlinks">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ClawPlotItem.rst.txt"
rel="nofollow"
target="_blank">Source .rst</a></li>
<li><a href="https://github.com/clawpack/doc/blob/dev/doc/ClawPlotItem.rst"
rel="nofollow"
target="_blank">Source on GitHub</a></li>
<li><a href="https://github.com/clawpack/doc/commits/dev/doc/ClawPlotItem.rst"
rel="nofollow"
target="_blank">History</a></li>
<li><a href="https://github.com/clawpack/doc/edit/dev/doc/ClawPlotItem.rst"
rel="nofollow"
target="_blank">Suggest Edits</a></li>
<li><a href="https://github.com/clawpack/doc/issues/new/choose"
rel="nofollow"
target="_blank">Raise an Issue</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
<h4>Latest Version</h4>
<ul>
<li><a href="./dev/ClawPlotItem.html">dev</a></li>
<li><a href="ClawPlotItem.html">v5.11.x</a></li>
</ul>
<h4>Older Versions</h4>
<ul>
<li><a href="./v5.10.x/ClawPlotItem.html">v5.10.x</a></li>
<li><a href="./v5.7.x/ClawPlotItem.html">v5.7.x</a></li>
<li><a href="./v5.8.x/ClawPlotItem.html">v5.8.x</a></li>
<li><a href="./v5.9.x/ClawPlotItem.html">v5.9.x</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright CC-BY 2024, The Clawpack Development Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-44811544-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>