Skip to content

Commit ddf848d

Browse files
committed
MNT make parameter optional if matplotlib < 3.4
1 parent 1fbba8a commit ddf848d

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

tutorials/notebooks/shortclips/00_setup_colab.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54-
"# !pip install -U --no-cache-dir gdown --pre\n# ![ -f \"vim-5-for-ccn.tar.gz\" ] || gdown --id 1b0I0Ytj06m6GCmfxfNrZuyF97fDo3NZb\n# ![ -d \"vim-5\" ] || tar xzf vim-5-for-ccn.tar.gz\n# !ln -s vim-5 shortclips\n# !apt-get install -qq inkscape > /dev/null\n# !pip install -q voxelwise_tutorials==0.1.2\n# ![ -f \"ngrok-stable-linux-amd64.zip\" ] || wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n# ![ -f \"ngrok\" ] || unzip ngrok-stable-linux-amd64.zip"
54+
"# !pip install -U --no-cache-dir gdown --pre\n# ![ -f \"vim-5-for-ccn.tar.gz\" ] || gdown --id 1b0I0Ytj06m6GCmfxfNrZuyF97fDo3NZb\n# ![ -d \"vim-5\" ] || tar xzf vim-5-for-ccn.tar.gz\n# !ln -s vim-5 shortclips\n# !apt-get install -qq inkscape > /dev/null\n# !pip install -q voxelwise_tutorials==0.1.3\n# ![ -f \"ngrok-stable-linux-amd64.zip\" ] || wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n# ![ -f \"ngrok\" ] || unzip ngrok-stable-linux-amd64.zip"
5555
]
5656
},
5757
{

tutorials/notebooks/shortclips/merged_for_colab.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"# ![ -d \"vim-5\" ] || tar xzf vim-5-for-ccn.tar.gz\n",
7979
"# !ln -s vim-5 shortclips\n",
8080
"# !apt-get install -qq inkscape > /dev/null\n",
81-
"# !pip install -q voxelwise_tutorials==0.1.2\n",
81+
"# !pip install -q voxelwise_tutorials==0.1.3\n",
8282
"# ![ -f \"ngrok-stable-linux-amd64.zip\" ] || wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n",
8383
"# ![ -f \"ngrok\" ] || unzip ngrok-stable-linux-amd64.zip"
8484
]

tutorials/shortclips/00_setup_colab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# ![ -d "vim-5" ] || tar xzf vim-5-for-ccn.tar.gz
3131
# !ln -s vim-5 shortclips
3232
# !apt-get install -qq inkscape > /dev/null
33-
# !pip install -q voxelwise_tutorials==0.1.2
33+
# !pip install -q voxelwise_tutorials==0.1.3
3434
# ![ -f "ngrok-stable-linux-amd64.zip" ] || wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
3535
# ![ -f "ngrok" ] || unzip ngrok-stable-linux-amd64.zip
3636

voxelwise_tutorials/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.2'
1+
__version__ = '0.1.3'

voxelwise_tutorials/regression_toy.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ def plot_2d(X, y, w, flat=True, alpha=None, show_noiseless=True):
8282

8383
fig = plt.figure(figsize=(6.7, 2.5))
8484

85+
#####################
8586
# left plot: y = f(x)
86-
ax = fig.add_subplot(121, projection='3d', computed_zorder=False)
87+
88+
try: # computed_zorder is only available in matplotlib >= 3.4
89+
ax = fig.add_subplot(121, projection='3d', computed_zorder=False)
90+
except AttributeError:
91+
ax = fig.add_subplot(121, projection='3d')
8792

8893
# to help matplotlib displays scatter points behind any surface, we
89-
# first plot the point below, then the surface, then the ponts above,
94+
# first plot the point below, then the surface, then the points above,
9095
# and use computed_zorder=False.
9196
above = y > X @ w
9297
ax.scatter3D(X[~above, 0], X[~above, 1], y[~above], alpha=0.5, color="C0")
@@ -103,6 +108,7 @@ def plot_2d(X, y, w, flat=True, alpha=None, show_noiseless=True):
103108
ax.set(xlabel="X[:, 0]", ylabel="X[:, 1]", zlabel="y",
104109
zlim=[yy.min(), yy.max()])
105110

111+
#########################
106112
# right plot: loss = f(w)
107113
if flat:
108114
ax = fig.add_subplot(122)

0 commit comments

Comments
 (0)