Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Update all notebooks to use new HoloViews options API (#86)
Browse files Browse the repository at this point in the history
* Removed magics from landsat spectral clustering notebook

* Removed magics from the Walker Lake notebook
  • Loading branch information
jlstevens authored and jsignell committed Feb 1, 2019
1 parent 15e650b commit 91e5209
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 12 additions & 6 deletions examples/topics/Landsat_Spectral_Clustering.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"import numpy as np\n",
"import xarray as xr\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"from holoviews.operation.datashader import regrid\n",
"import cartopy.crs as ccrs\n",
"import dask.array as da\n",
Expand Down Expand Up @@ -110,7 +111,16 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Image [invert_yaxis=True width=250 height=250 tools=['hover']] (cmap='viridis')\n",
"opts.defaults(\n",
" opts.Image(invert_yaxis=True, width=250, height=250, tools=['hover'], cmap='viridis'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hv.Layout([regrid(hv.Image(band, kdims=['x', 'y'])) for band in bands[:3]])"
]
},
Expand All @@ -120,7 +130,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Image [invert_yaxis=True width=250 height=250 tools=['hover']] (cmap='viridis')\n",
"hv.Layout([regrid(hv.Image(band, kdims=['x', 'y'])) for band in bands[3:]])"
]
},
Expand Down Expand Up @@ -223,8 +232,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Image [invert_yaxis=True width=250 height=250 tools=['hover']] (cmap='viridis')\n",
"hv.Layout([regrid(hv.Image(band, kdims=['x', 'y'])) for band in bands])"
"hv.Layout([regrid(hv.Image(band, kdims=['x', 'y'])) for band in bands]) "
]
},
{
Expand All @@ -233,7 +241,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Image [invert_yaxis=True width=250 height=250 tools=['hover']] (cmap='viridis')\n",
"hv.Layout([regrid(hv.Image(band, kdims=['x', 'y'])) for band in bands[3:]])"
]
},
Expand All @@ -243,7 +250,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Image [invert_yaxis=True width=250 height=250 tools=['hover']] (cmap='viridis')\n",
"hv.Image(labels)"
]
}
Expand Down
8 changes: 5 additions & 3 deletions examples/topics/Walker_Lake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"import numpy as np\n",
"import xarray as xr\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"import geoviews as gv\n",
"import datashader as ds\n",
"import cartopy.crs as ccrs\n",
Expand Down Expand Up @@ -186,7 +187,9 @@
"metadata": {},
"outputs": [],
"source": [
"%opts Image (cmap='viridis') [width=450 height=450 tools=['hover'] colorbar=True]"
"opts.defaults(\n",
" opts.Curve(width=600, tools=['hover']),\n",
" opts.Image(cmap='viridis', width=450, height=450, tools=['hover'], colorbar=True))"
]
},
{
Expand Down Expand Up @@ -280,7 +283,7 @@
"difference = gv.Image(diff, crs=crs, kdims=['lon', 'lat'], vdims=['ndvi'])\n",
"difference = difference.relabel('Difference in NDVI').redim(ndvi='delta_ndvi')\n",
"\n",
"rasterize(difference).redim.range(delta_ndvi=(-1.0,1.0)).options(cmap=coolwarm)"
"rasterize(difference).redim.range(delta_ndvi=(-1.0,1.0)).opts(cmap=coolwarm)"
]
},
{
Expand Down Expand Up @@ -315,7 +318,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Curve [width=600 tools=['hover']]\n",
"lon_y, lat_x = from_lon_lat(-118, 39) # Longitude of -118 and Latitude of 39\n",
"(difference.sample(lat=lat_x) + difference.sample(lon=lon_y)).cols(1)"
]
Expand Down

0 comments on commit 91e5209

Please sign in to comment.