-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathcolorbar_api.html
More file actions
606 lines (561 loc) · 58.2 KB
/
colorbar_api.html
File metadata and controls
606 lines (561 loc) · 58.2 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>matplotlib.colorbar — Matplotlib 3.3.1 documentation</title>
<link rel="stylesheet" href="../_static/mpl.css?v3.3.1-2-ge49322daa" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css" />
<link rel="stylesheet" type="text/css" href="../_static/gallery.css" />
<link rel="stylesheet" type="text/css" href="../_static/gallery-binder.css" />
<link rel="stylesheet" type="text/css" href="../_static/gallery-dataframe.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script src="../_static/clipboard.min.js"></script>
<script src="../_static/copybutton.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 3.3.1 documentation"
href="../_static/opensearch.xml"/>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="matplotlib.colors" href="colors_api.html" />
<link rel="prev" title="matplotlib.collections" href="collections_api.html" />
<link rel="top" title="Matplotlib 3.3.1 documentation" href="#" />
<link rel="canonical" href="https://matplotlib.org/stable/api/colorbar_api.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
<script data-domain="matplotlib.org" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
</head><body>
<div id="unreleased-message"> You are reading an old version of the documentation (v3.3.1). For the latest version see <a href="https://matplotlib.org/stable/api/colorbar_api.html">https://matplotlib.org/stable/api/colorbar_api.html</a></div>
<!--
<div id="annc-banner">
</div>
-->
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px; position: relative;">
<a href="../index.html">
<div style="float: left; position: absolute; width: 496px; bottom: 0; padding-bottom: 24px"><span style="float: right; color: #789; background: white">Version 3.3.1</span></div>
<img src="../_static/logo2_compressed.svg" height="125px" border="0" alt="matplotlib"/></a>
<!-- The "Fork me on github" ribbon -->
<div id="forkongithub"><a href="https://github.com/matplotlib/matplotlib">Fork me on GitHub</a></div>
</div>
<nav class="main-nav">
<ul>
<li><a href="../users/installing.html">Installation</a></li>
<li><a href="../contents.html">Documentation</a></li>
<li><a href="../gallery/index.html">Examples</a></li>
<li><a href="../tutorials/index.html">Tutorials</a></li>
<li><a href="../devel/index.html">Contributing</a></li>
<li class="nav-right">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" placeholder="Search"/>
</form>
</li>
</ul>
</nav>
<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="colors_api.html" title="matplotlib.colors"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="collections_api.html" title="matplotlib.collections"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">home</a>| </li>
<li><a href="../contents.html">contents</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">API Overview</a> »</li>
<li class="nav-item nav-item-this"><a href=""><code class="docutils literal notranslate"><span class="pre">matplotlib.colorbar</span></code></a></li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../contents.html">Documentation overview</a><ul>
<li><a href="index.html">API Overview</a><ul>
<li>Previous: <a href="collections_api.html" title="previous chapter"><code class="docutils literal notranslate"><span class="pre">matplotlib.collections</span></code></a></li>
<li>Next: <a href="colors_api.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">matplotlib.colors</span></code></a></li>
</ul></li>
</ul></li>
</ul>
</div>
<div id="sidebar-pagesource" role="note" aria-label="source link"
style="margin-top: 1.5em; padding-top: 0.1em; border-top: 1px solid #86989b">
<a href="../_sources/api/colorbar_api.rst.txt"
style="color: #c0c0c0" rel="nofollow">Show Page Source</a>
</div>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-matplotlib.colorbar">
<span id="matplotlib-colorbar"></span><h1><code class="docutils literal notranslate"><span class="pre">matplotlib.colorbar</span></code><a class="headerlink" href="#module-matplotlib.colorbar" title="Permalink to this headline">¶</a></h1>
<p>Colorbars are a visualization of the mapping from scalar values to colors.
In Matplotlib they are drawn into a dedicated <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Colorbars are typically created through <a class="reference internal" href="_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar" title="matplotlib.figure.Figure.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Figure.colorbar</span></code></a> or its pyplot
wrapper <a class="reference internal" href="_as_gen/matplotlib.pyplot.colorbar.html#matplotlib.pyplot.colorbar" title="matplotlib.pyplot.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pyplot.colorbar</span></code></a>, which use <a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes</span></code></a> and <a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Colorbar</span></code></a>
internally.</p>
<p class="last">As an end-user, you most likely won't have to call the methods or
instantiate the classes in this module explicitly.</p>
</div>
<dl class="docutils">
<dt><a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">ColorbarBase</span></code></a></dt><dd>The base class with full colorbar drawing functionality.
It can be used as-is to make a colorbar for a given colormap;
a mappable object (e.g., image) is not needed.</dd>
<dt><a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-class docutils literal notranslate"><span class="pre">Colorbar</span></code></a></dt><dd>On top of <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarBase</span></code></a> this connects the colorbar with a
<a class="reference internal" href="cm_api.html#matplotlib.cm.ScalarMappable" title="matplotlib.cm.ScalarMappable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ScalarMappable</span></code></a> such as an image or contour plot.</dd>
<dt><a class="reference internal" href="#matplotlib.colorbar.ColorbarPatch" title="matplotlib.colorbar.ColorbarPatch"><code class="xref py py-class docutils literal notranslate"><span class="pre">ColorbarPatch</span></code></a></dt><dd>A specialized <a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Colorbar</span></code></a> to support hatched contour plots.</dd>
<dt><a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-func docutils literal notranslate"><span class="pre">make_axes()</span></code></a></dt><dd>Create an <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> suitable for a colorbar. This functions can be
used with figures containing a single axes or with freely placed axes.</dd>
<dt><a class="reference internal" href="#matplotlib.colorbar.make_axes_gridspec" title="matplotlib.colorbar.make_axes_gridspec"><code class="xref py py-func docutils literal notranslate"><span class="pre">make_axes_gridspec()</span></code></a></dt><dd>Create a <a class="reference internal" href="_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase" title="matplotlib.axes.SubplotBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SubplotBase</span></code></a> suitable for a colorbar. This function should
be used for adding a colorbar to a <a class="reference internal" href="_as_gen/matplotlib.gridspec.GridSpec.html#matplotlib.gridspec.GridSpec" title="matplotlib.gridspec.GridSpec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GridSpec</span></code></a>.</dd>
</dl>
<dl class="py class">
<dt id="matplotlib.colorbar.Colorbar">
<em class="property">class </em><code class="descclassname">matplotlib.colorbar.</code><code class="descname">Colorbar</code><span class="sig-paren">(</span><em><span class="n">ax</span></em>, <em><span class="n">mappable</span></em>, <em><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.colorbar.ColorbarBase</span></code></a></p>
<p>This class connects a <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarBase</span></code></a> to a <a class="reference internal" href="cm_api.html#matplotlib.cm.ScalarMappable" title="matplotlib.cm.ScalarMappable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ScalarMappable</span></code></a>
such as an <a class="reference internal" href="image_api.html#matplotlib.image.AxesImage" title="matplotlib.image.AxesImage"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AxesImage</span></code></a> generated via <a class="reference internal" href="_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><code class="xref py py-obj docutils literal notranslate"><span class="pre">imshow</span></code></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This class is not intended to be instantiated directly; instead, use
<a class="reference internal" href="_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar" title="matplotlib.figure.Figure.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Figure.colorbar</span></code></a> or <a class="reference internal" href="_as_gen/matplotlib.pyplot.colorbar.html#matplotlib.pyplot.colorbar" title="matplotlib.pyplot.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pyplot.colorbar</span></code></a> to create a colorbar.</p>
</div>
<dl class="py method">
<dt id="matplotlib.colorbar.Colorbar.add_lines">
<code class="descname">add_lines</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">CS</span></em>, <em><span class="n">erase</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar.add_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar.add_lines" title="Permalink to this definition">¶</a></dt>
<dd><p>Add the lines from a non-filled <a class="reference internal" href="contour_api.html#matplotlib.contour.ContourSet" title="matplotlib.contour.ContourSet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ContourSet</span></code></a> to the colorbar.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>CS</strong><span class="classifier"><a class="reference internal" href="contour_api.html#matplotlib.contour.ContourSet" title="matplotlib.contour.ContourSet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ContourSet</span></code></a></span></dt><dd><p>The line positions are taken from the ContourSet levels. The
ContourSet must not be filled.</p>
</dd>
<dt><strong>erase</strong><span class="classifier">bool, default: True</span></dt><dd><p>Whether to remove any previously added lines.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.Colorbar.on_mappable_changed">
<code class="descname">on_mappable_changed</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">mappable</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar.on_mappable_changed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar.on_mappable_changed" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Update this colorbar to match the mappable's properties.</p>
<p>Typically this is automatically registered as an event handler
by <a class="reference internal" href="#matplotlib.colorbar.colorbar_factory" title="matplotlib.colorbar.colorbar_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">colorbar_factory()</span></code></a> and should not be called manually.</p>
<p class="rubric">Notes</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.3.</span></p>
</div>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.Colorbar.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove this colorbar from the figure.</p>
<p>If the colorbar was created with <code class="docutils literal notranslate"><span class="pre">use_gridspec=True</span></code> the previous
gridspec is restored.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.Colorbar.update_bruteforce">
<code class="descname">update_bruteforce</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">mappable</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar.update_bruteforce"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar.update_bruteforce" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Destroy and rebuild the colorbar. This is
intended to become obsolete, and will probably be
deprecated and then removed. It is not called when
the pyplot.colorbar function or the Figure.colorbar
method are used to create the colorbar.</p>
<p class="rubric">Notes</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.3.</span></p>
</div>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.Colorbar.update_normal">
<code class="descname">update_normal</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">mappable</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#Colorbar.update_normal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.Colorbar.update_normal" title="Permalink to this definition">¶</a></dt>
<dd><p>Update solid patches, lines, etc.</p>
<p>This is meant to be called when the norm of the image or contour plot
to which this colorbar belongs changes.</p>
<p>If the norm on the mappable is different than before, this resets the
locator and formatter for the axis, so if these have been customized,
they will need to be customized again. However, if the norm only
changes values of <em>vmin</em>, <em>vmax</em> or <em>cmap</em> then the old formatter
and locator will be preserved.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="matplotlib.colorbar.ColorbarBase">
<em class="property">class </em><code class="descclassname">matplotlib.colorbar.</code><code class="descname">ColorbarBase</code><span class="sig-paren">(</span><em><span class="n">ax</span></em>, <em><span class="o">*</span></em>, <em><span class="n">cmap</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">norm</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">alpha</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">boundaries</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">orientation</span><span class="o">=</span><span class="default_value">'vertical'</span></em>, <em><span class="n">ticklocation</span><span class="o">=</span><span class="default_value">'auto'</span></em>, <em><span class="n">extend</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">spacing</span><span class="o">=</span><span class="default_value">'uniform'</span></em>, <em><span class="n">ticks</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">format</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">drawedges</span><span class="o">=</span><span class="default_value">False</span></em>, <em><span class="n">filled</span><span class="o">=</span><span class="default_value">True</span></em>, <em><span class="n">extendfrac</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">extendrect</span><span class="o">=</span><span class="default_value">False</span></em>, <em><span class="n">label</span><span class="o">=</span><span class="default_value">''</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Draw a colorbar in an existing axes.</p>
<p>There are only some rare cases in which you would work directly with a
<a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarBase</span></code></a> as an end-user. Typically, colorbars are used
with <a class="reference internal" href="cm_api.html#matplotlib.cm.ScalarMappable" title="matplotlib.cm.ScalarMappable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ScalarMappable</span></code></a>s such as an <a class="reference internal" href="image_api.html#matplotlib.image.AxesImage" title="matplotlib.image.AxesImage"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AxesImage</span></code></a> generated via
<a class="reference internal" href="_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><code class="xref py py-obj docutils literal notranslate"><span class="pre">imshow</span></code></a>. For these cases you will use <a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Colorbar</span></code></a> and
likely create it via <a class="reference internal" href="_as_gen/matplotlib.pyplot.colorbar.html#matplotlib.pyplot.colorbar" title="matplotlib.pyplot.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pyplot.colorbar</span></code></a> or <a class="reference internal" href="_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar" title="matplotlib.figure.Figure.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Figure.colorbar</span></code></a>.</p>
<p>The main application of using a <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase" title="matplotlib.colorbar.ColorbarBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarBase</span></code></a> explicitly is drawing
colorbars that are not associated with other elements in the figure, e.g.
when showing a colormap by itself.</p>
<p>If the <em>cmap</em> kwarg is given but <em>boundaries</em> and <em>values</em> are left as
None, then the colormap will be displayed on a 0-1 scale. To show the
under- and over-value colors, specify the <em>norm</em> as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">norm</span><span class="o">=</span><span class="n">colors</span><span class="o">.</span><span class="n">Normalize</span><span class="p">(</span><span class="n">clip</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</pre></div>
</div>
<p>To show the colors versus index instead of on the 0-1 scale,
use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">norm</span><span class="o">=</span><span class="n">colors</span><span class="o">.</span><span class="n">NoNorm</span><span class="p">()</span>
</pre></div>
</div>
<p>Useful public methods are <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase.set_label" title="matplotlib.colorbar.ColorbarBase.set_label"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_label()</span></code></a> and <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase.add_lines" title="matplotlib.colorbar.ColorbarBase.add_lines"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_lines()</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>ax</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> instance in which the colorbar is drawn.</p>
</dd>
<dt><strong>cmap</strong><span class="classifier"><a class="reference internal" href="_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap" title="matplotlib.colors.Colormap"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Colormap</span></code></a>, default: <code class="docutils literal notranslate"><a class="reference external" href="../tutorials/introductory/customizing.html?highlight=image.cmap#a-sample-matplotlibrc-file"><span class="pre">rcParams["image.cmap"]</span></a></code> (default: <code class="docutils literal notranslate"><span class="pre">'viridis'</span></code>)</span></dt><dd><p>The colormap to use.</p>
</dd>
<dt><strong>norm</strong><span class="classifier"><a class="reference internal" href="_as_gen/matplotlib.colors.Normalize.html#matplotlib.colors.Normalize" title="matplotlib.colors.Normalize"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Normalize</span></code></a></span></dt><dd></dd>
<dt><strong>alpha</strong><span class="classifier">float</span></dt><dd><p>The colorbar transparency between 0 (transparent) and 1 (opaque).</p>
</dd>
<dt><strong>values</strong></dt><dd></dd>
<dt><strong>boundaries</strong></dt><dd></dd>
<dt><strong>orientation</strong><span class="classifier">{'vertical', 'horizontal'}</span></dt><dd></dd>
<dt><strong>ticklocation</strong><span class="classifier">{'auto', 'left', 'right', 'top', 'bottom'}</span></dt><dd></dd>
<dt><strong>extend</strong><span class="classifier">{'neither', 'both', 'min', 'max'}</span></dt><dd></dd>
<dt><strong>spacing</strong><span class="classifier">{'uniform', 'proportional'}</span></dt><dd></dd>
<dt><strong>ticks</strong><span class="classifier"><a class="reference internal" href="ticker_api.html#matplotlib.ticker.Locator" title="matplotlib.ticker.Locator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Locator</span></code></a> or array-like of float</span></dt><dd></dd>
<dt><strong>format</strong><span class="classifier">str or <a class="reference internal" href="ticker_api.html#matplotlib.ticker.Formatter" title="matplotlib.ticker.Formatter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Formatter</span></code></a></span></dt><dd></dd>
<dt><strong>drawedges</strong><span class="classifier">bool</span></dt><dd></dd>
<dt><strong>filled</strong><span class="classifier">bool</span></dt><dd></dd>
<dt><strong>extendfrac</strong></dt><dd></dd>
<dt><strong>extendrec</strong></dt><dd></dd>
<dt><strong>label</strong><span class="classifier">str</span></dt><dd></dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Attributes:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>ax</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> instance in which the colorbar is drawn.</p>
</dd>
<dt><strong>lines</strong><span class="classifier">list</span></dt><dd><p>A list of <a class="reference internal" href="collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LineCollection</span></code></a> if lines were drawn, otherwise
an empty list.</p>
</dd>
<dt><strong>dividers</strong><span class="classifier"><a class="reference internal" href="collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LineCollection</span></code></a></span></dt><dd><p>A LineCollection if <em>drawedges</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.add_lines">
<code class="descname">add_lines</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">levels</span></em>, <em><span class="n">colors</span></em>, <em><span class="n">linewidths</span></em>, <em><span class="n">erase</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.add_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.add_lines" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw lines on the colorbar.</p>
<p>The lines are appended to the list <code class="xref py py-attr docutils literal notranslate"><span class="pre">lines</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>levels</strong><span class="classifier">array-like</span></dt><dd><p>The positions of the lines.</p>
</dd>
<dt><strong>colors</strong><span class="classifier">color or list of colors</span></dt><dd><p>Either a single color applying to all lines or one color value for
each line.</p>
</dd>
<dt><strong>linewidths</strong><span class="classifier">float or array-like</span></dt><dd><p>Either a single linewidth applying to all lines or one linewidth
for each line.</p>
</dd>
<dt><strong>erase</strong><span class="classifier">bool, default: True</span></dt><dd><p>Whether to remove any previously added lines.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.config_axis">
<code class="descname">config_axis</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.config_axis"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.config_axis" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>]</p>
<p class="rubric">Notes</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.3: </span></p>
</div>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.draw_all">
<code class="descname">draw_all</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.draw_all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.draw_all" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate any free parameters based on the current cmap and norm,
and do all the drawing.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.get_ticks">
<code class="descname">get_ticks</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">minor</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.get_ticks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.get_ticks" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the x ticks as a list of locations.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.minorticks_off">
<code class="descname">minorticks_off</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.minorticks_off"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.minorticks_off" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn the minor ticks of the colorbar off.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.minorticks_on">
<code class="descname">minorticks_on</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.minorticks_on"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.minorticks_on" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn the minor ticks of the colorbar on without extruding
into the "extend regions".</p>
</dd></dl>
<dl class="py attribute">
<dt id="matplotlib.colorbar.ColorbarBase.n_rasterize">
<code class="descname">n_rasterize</code><em class="property"> = 50</em><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.n_rasterize" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove this colorbar from the figure.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.set_alpha">
<code class="descname">set_alpha</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">alpha</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.set_alpha"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.set_alpha" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the transparency between 0 (transparent) and 1 (opaque).</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.set_label">
<code class="descname">set_label</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">label</span></em>, <em><span class="o">*</span></em>, <em><span class="n">loc</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.set_label"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.set_label" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a label to the long axis of the colorbar.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.set_ticklabels">
<code class="descname">set_ticklabels</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">ticklabels</span></em>, <em><span class="n">update_ticks</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.set_ticklabels"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.set_ticklabels" title="Permalink to this definition">¶</a></dt>
<dd><p>Set tick labels.</p>
<p>Tick labels are updated immediately unless <em>update_ticks</em> is <em>False</em>,
in which case one should call <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase.update_ticks" title="matplotlib.colorbar.ColorbarBase.update_ticks"><code class="xref py py-obj docutils literal notranslate"><span class="pre">update_ticks</span></code></a> explicitly.</p>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.set_ticks">
<code class="descname">set_ticks</code><span class="sig-paren">(</span><em><span class="n">self</span></em>, <em><span class="n">ticks</span></em>, <em><span class="n">update_ticks</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.set_ticks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.set_ticks" title="Permalink to this definition">¶</a></dt>
<dd><p>Set tick locations.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>ticks</strong><span class="classifier">array-like or <a class="reference internal" href="ticker_api.html#matplotlib.ticker.Locator" title="matplotlib.ticker.Locator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Locator</span></code></a> or None</span></dt><dd><p>The tick positions can be hard-coded by an array of values; or
they can be defined by a <a class="reference internal" href="ticker_api.html#matplotlib.ticker.Locator" title="matplotlib.ticker.Locator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Locator</span></code></a>. Setting to <em>None</em> reverts
to using a default locator.</p>
</dd>
<dt><strong>update_ticks</strong><span class="classifier">bool, default: True</span></dt><dd><p>If True, tick locations are updated immediately. If False, the
user has to call <a class="reference internal" href="#matplotlib.colorbar.ColorbarBase.update_ticks" title="matplotlib.colorbar.ColorbarBase.update_ticks"><code class="xref py py-obj docutils literal notranslate"><span class="pre">update_ticks</span></code></a> later to update the ticks.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="py method">
<dt id="matplotlib.colorbar.ColorbarBase.update_ticks">
<code class="descname">update_ticks</code><span class="sig-paren">(</span><em><span class="n">self</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarBase.update_ticks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarBase.update_ticks" title="Permalink to this definition">¶</a></dt>
<dd><p>Force the update of the ticks and ticklabels. This must be
called whenever the tick locator and/or tick formatter changes.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="matplotlib.colorbar.ColorbarPatch">
<em class="property">class </em><code class="descclassname">matplotlib.colorbar.</code><code class="descname">ColorbarPatch</code><span class="sig-paren">(</span><em><span class="n">ax</span></em>, <em><span class="n">mappable</span></em>, <em><span class="o">**</span><span class="n">kw</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#ColorbarPatch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.ColorbarPatch" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.colorbar.Colorbar</span></code></a></p>
<p>A Colorbar that uses a list of <a class="reference internal" href="_as_gen/matplotlib.patches.Patch.html#matplotlib.patches.Patch" title="matplotlib.patches.Patch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Patch</span></code></a> instances rather than the
default <a class="reference internal" href="collections_api.html#matplotlib.collections.PatchCollection" title="matplotlib.collections.PatchCollection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PatchCollection</span></code></a> created by <a class="reference internal" href="_as_gen/matplotlib.axes.Axes.pcolor.html#matplotlib.axes.Axes.pcolor" title="matplotlib.axes.Axes.pcolor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pcolor</span></code></a>,
because the latter does not allow the hatch pattern to vary among the
members of the collection.</p>
</dd></dl>
<dl class="py function">
<dt id="matplotlib.colorbar.colorbar_factory">
<code class="descclassname">matplotlib.colorbar.</code><code class="descname">colorbar_factory</code><span class="sig-paren">(</span><em><span class="n">cax</span></em>, <em><span class="n">mappable</span></em>, <em><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#colorbar_factory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.colorbar_factory" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a colorbar on the given axes for the given mappable.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is a low-level function to turn an existing axes into a colorbar
axes. Typically, you'll want to use <a class="reference internal" href="_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar" title="matplotlib.figure.Figure.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">colorbar</span></code></a> instead, which
automatically handles creation and placement of a suitable axes as
well.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>cax</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> to turn into a colorbar.</p>
</dd>
<dt><strong>mappable</strong><span class="classifier"><a class="reference internal" href="cm_api.html#matplotlib.cm.ScalarMappable" title="matplotlib.cm.ScalarMappable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ScalarMappable</span></code></a></span></dt><dd><p>The mappable to be described by the colorbar.</p>
</dd>
<dt><strong>**kwargs</strong></dt><dd><p>Keyword arguments are passed to the respective colorbar class.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><a class="reference internal" href="#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Colorbar</span></code></a> or <a class="reference internal" href="#matplotlib.colorbar.ColorbarPatch" title="matplotlib.colorbar.ColorbarPatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarPatch</span></code></a></dt><dd><p>The created colorbar instance. <a class="reference internal" href="#matplotlib.colorbar.ColorbarPatch" title="matplotlib.colorbar.ColorbarPatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ColorbarPatch</span></code></a> is only used if
<em>mappable</em> is a <a class="reference internal" href="contour_api.html#matplotlib.contour.ContourSet" title="matplotlib.contour.ContourSet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ContourSet</span></code></a> with hatches.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="py function">
<dt id="matplotlib.colorbar.make_axes">
<code class="descclassname">matplotlib.colorbar.</code><code class="descname">make_axes</code><span class="sig-paren">(</span><em><span class="n">parents</span></em>, <em><span class="n">location</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">orientation</span><span class="o">=</span><span class="default_value">None</span></em>, <em><span class="n">fraction</span><span class="o">=</span><span class="default_value">0.15</span></em>, <em><span class="n">shrink</span><span class="o">=</span><span class="default_value">1.0</span></em>, <em><span class="n">aspect</span><span class="o">=</span><span class="default_value">20</span></em>, <em><span class="o">**</span><span class="n">kw</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#make_axes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.make_axes" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> suitable for a colorbar.</p>
<p>The axes is placed in the figure of the <em>parents</em> axes, by resizing and
repositioning <em>parents</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>parents</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a> or list of <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The Axes to use as parents for placing the colorbar.</p>
</dd>
<dt><strong>location</strong><span class="classifier">None or {'left', 'right', 'top', 'bottom'}</span></dt><dd><p>The position, relative to <em>parents</em>, where the colorbar axes
should be created. If None, the value will either come from the
given <code class="docutils literal notranslate"><span class="pre">orientation</span></code>, else it will default to 'right'.</p>
</dd>
<dt><strong>orientation</strong><span class="classifier">None or {'vertical', 'horizontal'}</span></dt><dd><p>The orientation of the colorbar. Typically, this keyword shouldn't
be used, as it can be derived from the <code class="docutils literal notranslate"><span class="pre">location</span></code> keyword.</p>
</dd>
<dt><strong>fraction</strong><span class="classifier">float, default: 0.15</span></dt><dd><p>Fraction of original axes to use for colorbar.</p>
</dd>
<dt><strong>shrink</strong><span class="classifier">float, default: 1.0</span></dt><dd><p>Fraction by which to multiply the size of the colorbar.</p>
</dd>
<dt><strong>aspect</strong><span class="classifier">float, default: 20</span></dt><dd><p>Ratio of long to short dimensions.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
<dt><strong>cax</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The child axes.</p>
</dd>
<dt><strong>kw</strong><span class="classifier">dict</span></dt><dd><p>The reduced keyword dictionary to be passed when creating the colorbar
instance.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Other Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>pad</strong><span class="classifier">float, default: 0.05 if vertical, 0.15 if horizontal</span></dt><dd><p>Fraction of original axes between colorbar and new image axes.</p>
</dd>
<dt><strong>anchor</strong><span class="classifier">(float, float), optional</span></dt><dd><p>The anchor point of the colorbar axes.
Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.</p>
</dd>
<dt><strong>panchor</strong><span class="classifier">(float, float), or <em>False</em>, optional</span></dt><dd><p>The anchor point of the colorbar parent axes. If <em>False</em>, the parent
axes' anchor will be unchanged.
Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="py function">
<dt id="matplotlib.colorbar.make_axes_gridspec">
<code class="descclassname">matplotlib.colorbar.</code><code class="descname">make_axes_gridspec</code><span class="sig-paren">(</span><em><span class="n">parent</span></em>, <em><span class="o">*</span></em>, <em><span class="n">fraction</span><span class="o">=</span><span class="default_value">0.15</span></em>, <em><span class="n">shrink</span><span class="o">=</span><span class="default_value">1.0</span></em>, <em><span class="n">aspect</span><span class="o">=</span><span class="default_value">20</span></em>, <em><span class="o">**</span><span class="n">kw</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/matplotlib/colorbar.html#make_axes_gridspec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#matplotlib.colorbar.make_axes_gridspec" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <a class="reference internal" href="_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase" title="matplotlib.axes.SubplotBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SubplotBase</span></code></a> suitable for a colorbar.</p>
<p>The axes is placed in the figure of the <em>parent</em> axes, by resizing and
repositioning <em>parent</em>.</p>
<p>This function is similar to <a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes</span></code></a>. Primary differences are</p>
<ul class="simple">
<li><a class="reference internal" href="#matplotlib.colorbar.make_axes_gridspec" title="matplotlib.colorbar.make_axes_gridspec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes_gridspec</span></code></a> only handles the <em>orientation</em> keyword
and cannot handle the <em>location</em> keyword.</li>
<li><a class="reference internal" href="#matplotlib.colorbar.make_axes_gridspec" title="matplotlib.colorbar.make_axes_gridspec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes_gridspec</span></code></a> should only be used with a <a class="reference internal" href="_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase" title="matplotlib.axes.SubplotBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SubplotBase</span></code></a> parent.</li>
<li><a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes</span></code></a> creates an <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a>; <a class="reference internal" href="#matplotlib.colorbar.make_axes_gridspec" title="matplotlib.colorbar.make_axes_gridspec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes_gridspec</span></code></a> creates a
<a class="reference internal" href="_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase" title="matplotlib.axes.SubplotBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SubplotBase</span></code></a>.</li>
<li><a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes</span></code></a> updates the position of the parent. <a class="reference internal" href="#matplotlib.colorbar.make_axes_gridspec" title="matplotlib.colorbar.make_axes_gridspec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes_gridspec</span></code></a>
replaces the <code class="docutils literal notranslate"><span class="pre">grid_spec</span></code> attribute of the parent with a new one.</li>
</ul>
<p>While this function is meant to be compatible with <a class="reference internal" href="#matplotlib.colorbar.make_axes" title="matplotlib.colorbar.make_axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_axes</span></code></a>,
there could be some minor differences.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>parent</strong><span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code></a></span></dt><dd><p>The Axes to use as parent for placing the colorbar.</p>
</dd>
<dt><strong>fraction</strong><span class="classifier">float, default: 0.15</span></dt><dd><p>Fraction of original axes to use for colorbar.</p>
</dd>
<dt><strong>shrink</strong><span class="classifier">float, default: 1.0</span></dt><dd><p>Fraction by which to multiply the size of the colorbar.</p>
</dd>
<dt><strong>aspect</strong><span class="classifier">float, default: 20</span></dt><dd><p>Ratio of long to short dimensions.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
<dt><strong>cax</strong><span class="classifier"><a class="reference internal" href="_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase" title="matplotlib.axes.SubplotBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SubplotBase</span></code></a></span></dt><dd><p>The child axes.</p>
</dd>
<dt><strong>kw</strong><span class="classifier">dict</span></dt><dd><p>The reduced keyword dictionary to be passed when creating the colorbar
instance.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Other Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>orientation</strong><span class="classifier">{'vertical', 'horizontal'}, default: 'vertical'</span></dt><dd><p>The orientation of the colorbar.</p>
</dd>
<dt><strong>pad</strong><span class="classifier">float, default: 0.05 if vertical, 0.15 if horizontal</span></dt><dd><p>Fraction of original axes between colorbar and new image axes.</p>
</dd>
<dt><strong>anchor</strong><span class="classifier">(float, float), optional</span></dt><dd><p>The anchor point of the colorbar axes.
Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.</p>
</dd>
<dt><strong>panchor</strong><span class="classifier">(float, float), or <em>False</em>, optional</span></dt><dd><p>The anchor point of the colorbar parent axes. If <em>False</em>, the parent
axes' anchor will be unchanged.
Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<footer>
<div class="footer">
© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2020 The Matplotlib development team.
<br />
Last updated on Aug 14, 2020.
Created using
<a href="http://sphinx-doc.org/">Sphinx</a> 3.1.1.
Doc version v3.3.1-2-ge49322daa.
</div>
</footer>
</body>
</html>