Skip to content

Commit 8fcfe1a

Browse files
committed
add cbar example to notebook
1 parent f7a1061 commit 8fcfe1a

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

docs/user-guide/imshow.ipynb

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919
"import numpy as np"
2020
]
2121
},
22+
{
23+
"cell_type": "markdown",
24+
"id": "2",
25+
"metadata": {},
26+
"source": [
27+
"## Basic imshow"
28+
]
29+
},
2230
{
2331
"cell_type": "code",
2432
"execution_count": null,
25-
"id": "2",
33+
"id": "3",
2634
"metadata": {},
2735
"outputs": [],
2836
"source": [
@@ -34,6 +42,29 @@
3442
"\n",
3543
"fig"
3644
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"id": "4",
49+
"metadata": {},
50+
"source": [
51+
"## With a colorbar"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": null,
57+
"id": "5",
58+
"metadata": {},
59+
"outputs": [],
60+
"source": [
61+
"fig, ax = plt.subplots()\n",
62+
"\n",
63+
"im = ax.imshow(np.random.random((20, 20)))\n",
64+
"fig.colorbar(im)\n",
65+
"\n",
66+
"fig"
67+
]
3768
}
3869
],
3970
"metadata": {

src/matplotgl/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class Colorbar:
14-
def __init__(self, widget, mappable, height: int | float):
14+
def __init__(self, widget, mappable, height: float):
1515
self._mappable = mappable
1616
self._height = height
1717
self._widget = widget

0 commit comments

Comments
 (0)