Skip to content

Commit

Permalink
Updated Box and Ellipse element notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens committed Jun 2, 2017
1 parent f0d0e3a commit 3ebcbbd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
16 changes: 10 additions & 6 deletions examples/elements/bokeh/Box.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"A ``Box`` is an annotation that takes a center x-position, a center y-position and a width:"
"A ``Box`` is an annotation that takes a center x-position, a center y-position and a size:"
]
},
{
Expand All @@ -41,17 +41,19 @@
},
"outputs": [],
"source": [
"%%opts Box (line_width=5 color='purple') Image (cmap='gray')\n",
"%%opts Box (line_width=5 color='red') Image (cmap='gray')\n",
"data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n",
"data[range(30, 70), range(30, 70)] = -3\n",
"hv.Image(data) * hv.Box(-0, 0, 0.5 )"
"data[range(40, 60) + range(40,50), range(20, 40)+ range(70,80)] = -3\n",
"hv.Image(data) * hv.Box(-0.2, 0, 0.2 ) * hv.Box(-0, 0, (0.4,0.9) )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In addition to these arguments, it supports an optional ``aspect ratio``:"
"In addition to these arguments, it supports an optional ``aspect ratio``:\n",
"\n",
"By default, the size argument results in a square such as the small square shown above. Alternatively, the size can be given as the tuple ``(width, height)`` resulting in a rectangle. If you only supply a size value, you can still specify a rectangle by specifying an optional aspect value. In addition, you can also set the orientation (in radians, rotating anticlockwise):"
]
},
{
Expand All @@ -63,7 +65,9 @@
"outputs": [],
"source": [
"%%opts Box (line_width=5 color='purple') Image (cmap='gray')\n",
"hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3)"
"data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n",
"data[range(30, 70), range(30, 70)] = -3\n",
"hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3, orientation=-np.pi/4)"
]
}
],
Expand Down
6 changes: 3 additions & 3 deletions examples/elements/bokeh/Ellipse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> Ellipse Element</dd>\n",
" <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
" <dt>Backends</dt> <dd>[Matplotlib](./Ellipse.ipynb)</dd> <dd>[Bokeh](../bokeh/Ellipse.ipynb)</dd>\n",
" <dt>Dependencies</dt> <dd>Bokeh</dd>\n",
" <dt>Backends</dt> <dd>[Bokeh](./Ellipse.ipynb)</dd> <dd>[Matplotlib](../matplotlib/Ellipse.ipynb)</dd>\n",
"</dl>\n",
"</div>"
]
Expand Down Expand Up @@ -56,7 +56,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, the size is just a diameter, resulting in a circle such as the blue circle above. Alternatively, the size can be given as the tuple ``(width, height)`` as shown for the red ellipse above. If you only supply a diameter, you can still specify an ellipse by specifying an optional aspect value and you can also set the orientation (in radians, rotatinf anticlockwise):"
"By default, the size is just a diameter, resulting in a circle such as the blue circle above. Alternatively, the size can be given as the tuple ``(width, height)`` as shown for the red ellipse above. If you only supply a diameter, you can still specify an ellipse by specifying an optional aspect value. In addition, you can also set the orientation (in radians, rotating anticlockwise):"
]
},
{
Expand Down
16 changes: 10 additions & 6 deletions examples/elements/matplotlib/Box.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"A ``Box`` is an annotation that takes a center x-position, a center y-position and a width:"
"A ``Box`` is an annotation that takes a center x-position, a center y-position and a size:"
]
},
{
Expand All @@ -41,17 +41,19 @@
},
"outputs": [],
"source": [
"%%opts Box (linewidth=5 color='purple') Image (cmap='gray')\n",
"%%opts Box (linewidth=5 color='red') Image (cmap='gray')\n",
"data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n",
"data[range(30, 70), range(30, 70)] = -3\n",
"hv.Image(data) * hv.Box(-0, 0, 0.5 )"
"data[range(40, 60) + range(40,50), range(20, 40)+ range(70,80)] = -3\n",
"hv.Image(data) * hv.Box(-0.2, 0, 0.2 ) * hv.Box(-0, 0, (0.4,0.9) )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In addition to these arguments, it supports an optional ``aspect ratio``:"
"In addition to these arguments, it supports an optional ``aspect ratio``:\n",
"\n",
"By default, the size argument results in a square such as the small square shown above. Alternatively, the size can be given as the tuple ``(width, height)`` resulting in a rectangle. If you only supply a size value, you can still specify a rectangle by specifying an optional aspect value. In addition, you can also set the orientation (in radians, rotating anticlockwise):"
]
},
{
Expand All @@ -63,7 +65,9 @@
"outputs": [],
"source": [
"%%opts Box (linewidth=5 color='purple') Image (cmap='gray')\n",
"hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3)"
"data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n",
"data[range(30, 70), range(30, 70)] = -3\n",
"hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3, orientation=-np.pi/4)"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/elements/matplotlib/Ellipse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, the size is just a diameter, resulting in a circle such as the blue circle above. Alternatively, the size can be given as the tuple ``(width, height)`` as shown for the red ellipse above. If you only supply a diameter, you can still specify an ellipse by specifying an optional aspect value and you can also set the orientation (in radians, rotatinf anticlockwise):"
"By default, the size is just a diameter, resulting in a circle such as the blue circle above. Alternatively, the size can be given as the tuple ``(width, height)`` as shown for the red ellipse above. If you only supply a diameter, you can still specify an ellipse by specifying an optional aspect value. In addition, you can also set the orientation (in radians, rotating anticlockwise):"
]
},
{
Expand Down

0 comments on commit 3ebcbbd

Please sign in to comment.