Skip to content

Commit

Permalink
Merge 06108e3 into 07177fb
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens committed Feb 20, 2016
2 parents 07177fb + 06108e3 commit 82d8cdd
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions doc/Tutorials/Elements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-10:10,-10:10] * 0.25\n",
"y,x = np.mgrid[-10:10,-10:10] * 0.25\n",
"sine_rings = np.sin(x**2+y**2)*np.pi+np.pi\n",
"exp_falloff = 1/np.exp((x**2+y**2)/8)\n",
"\n",
Expand Down Expand Up @@ -817,7 +817,7 @@
"outputs": [],
"source": [
"%%opts Scatter3D [azimuth=40 elevation=20]\n",
"x,y = np.mgrid[-5:5, -5:5] * 0.1\n",
"y,x = np.mgrid[-5:5, -5:5] * 0.1\n",
"heights = np.sin(x**2+y**2)\n",
"hv.Scatter3D(zip(x.flat,y.flat,heights.flat))"
]
Expand Down Expand Up @@ -864,7 +864,18 @@
"source": [
"**A collection of raster image types**\n",
"\n",
"The second large class of ``Elements`` is the raster elements. Like ``Points`` and unlike the other ``Chart`` elements, ``Raster Elements`` live in a 2D key-dimensions space. For the ``Image``, ``RGB``, and ``HSV`` elements, the coordinates of this two-dimensional key space are defined in a [continuously indexable coordinate system](Continuous_Coordinates.ipynb)."
"The second large class of ``Elements`` is the raster elements. Like ``Points`` and unlike the other ``Chart`` elements, ``Raster Elements`` live in a 2D key-dimensions space. For the ``Image``, ``RGB``, and ``HSV`` elements, the coordinates of this two-dimensional key space are defined in a [continuously indexable coordinate system](Continuous_Coordinates.ipynb). We can use ``np.meshgrid`` to define the appropriate sampling along the ``x`` and ``y`` dimensions:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x,y = np.meshgrid(np.linspace(-5,5,101), np.linspace(5,-5,101))"
]
},
{
Expand All @@ -889,7 +900,6 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-50:51, -50:51] * 0.1\n",
"hv.Raster(np.sin(x**2+y**2))"
]
},
Expand Down Expand Up @@ -994,11 +1004,9 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-50:51, -50:51] * 0.1\n",
"bounds=(-1,-1,1,1) # Coordinate system: (left, bottom, top, right)\n",
"\n",
"bounds=(-5,-5,5,5) # Coordinate system: (left, bottom, top, right)\n",
"(hv.Image(np.sin(x**2+y**2), bounds=bounds) \n",
" + hv.Image(np.sin(x**2+y**2), bounds=bounds)[-0.5:0.5, -0.5:0.5])"
" + hv.Image(np.sin(x**2+y**2), bounds=bounds)[-2.5:2.5, -2.5:2.5])"
]
},
{
Expand Down Expand Up @@ -1032,8 +1040,6 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-50:51, -50:51] * 0.1\n",
"\n",
"r = 0.5*np.sin(np.pi +3*x**2+y**2)+0.5\n",
"g = 0.5*np.sin(x**2+2*y**2)+0.5\n",
"b = 0.5*np.sin(np.pi/2+x**2+y**2)+0.5\n",
Expand Down Expand Up @@ -1109,10 +1115,9 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-50:51, -50:51] * 0.1\n",
"h = 0.5 + np.sin(0.2*(x**2+y**2)) / 2.0\n",
"s = 0.5*np.cos(y*3)+0.5\n",
"v = 0.5*np.cos(x*3)+0.5\n",
"s = 0.5*np.cos(x*3)+0.5\n",
"v = 0.5*np.cos(y*3)+0.5\n",
"\n",
"hv.HSV(np.dstack([h, s, v]))"
]
Expand Down Expand Up @@ -1412,8 +1417,6 @@
},
"outputs": [],
"source": [
"x,y = np.mgrid[-50:51, -50:51] * 0.1\n",
"\n",
"def circle(radius, x=0, y=0):\n",
" angles = np.linspace(0, 2*np.pi, 100)\n",
" return np.array( list(zip(x+radius*np.sin(angles), y+radius*np.cos(angles))))\n",
Expand Down

0 comments on commit 82d8cdd

Please sign in to comment.