Skip to content

Commit

Permalink
Updated attractors notebook to store colormaps (holoviz#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbednar authored Oct 6, 2018
1 parent 8f6e5ba commit 660b78f
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 93 deletions.
34 changes: 17 additions & 17 deletions examples/topics/Strange_Attractors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"And let's collect a variety of [white-background, uniform sequential colormaps](http://holoviews.org/user_guide/Colormaps.html) that we can use for subsequent plots:"
"And let's load some colormaps that we can use for subsequent plots:"
]
},
{
Expand All @@ -157,8 +157,8 @@
"outputs": [],
"source": [
"from colorcet import palette\n",
"cmaps = [palette[p][::-1] for p in ['bgy', 'bmw', 'bgyw', 'bmy','fire', 'gray', 'kgy', 'kbc']]\n",
"cmaps += [viridis[::-1], inferno[::-1]]"
"palette[\"viridis\"]=viridis\n",
"palette[\"inferno\"]=inferno"
]
},
{
Expand All @@ -181,10 +181,10 @@
" \"\"\"Return a list of available argument lists for the given type of attractor\"\"\"\n",
" return [v[1:] for v in vals if v[0]==name] \n",
"\n",
"def plot(fn, c=0, vals=None, **kw):\n",
" \"\"\"Plot the given attractor `fn` once per provided set of arguments. `c` changes the colormap ordering.\"\"\"\n",
" v=args(fn.__name__) if vals is None else vals\n",
" return tf.Images(*[dsplot(fn, v[i], cmap=cmaps[(i+c)%len(cmaps)], **kw) for i in range(len(v))]).cols(4)"
"def plot(fn, vals=None, **kw):\n",
" \"\"\"Plot the given attractor `fn` once per provided set of arguments.\"\"\"\n",
" vargs=args(fn.__name__) if vals is None else vals\n",
" return tf.Images(*[dsplot(fn, v[1:], cmap=palette[v[0]][::-1], **kw) for v in vargs]).cols(4)"
]
},
{
Expand Down Expand Up @@ -216,7 +216,7 @@
"num = 4\n",
"\n",
"rvals=np.c_[np.zeros((num,2)), numpy.random.random((num,4))*4-2]\n",
"plot(Clifford, 1, rvals, label=True)"
"plot(Clifford, vals=[[\"kbc\"]+list(rvals[i]) for i in range(len(rvals))], label=True)"
]
},
{
Expand All @@ -242,7 +242,7 @@
" return sin(a * y) - cos(b * x), \\\n",
" sin(c * x) - cos(d * y)\n",
"\n",
"plot(De_Jong,7)"
"plot(De_Jong)"
]
},
{
Expand All @@ -265,7 +265,7 @@
" return d * sin(a * x) - sin(b * y), \\\n",
" c * cos(a * x) + cos(b * y)\n",
"\n",
"plot(Svensson,1)"
"plot(Svensson)"
]
},
{
Expand All @@ -288,7 +288,7 @@
" return sin(x*y/b)*y + cos(a*x-y), \\\n",
" x + sin(y)/b\n",
"\n",
"plot(Bedhead, 6)"
"plot(Bedhead)"
]
},
{
Expand Down Expand Up @@ -347,7 +347,7 @@
"metadata": {},
"outputs": [],
"source": [
"plot(Hopalong2, 5)"
"plot(Hopalong2)"
]
},
{
Expand Down Expand Up @@ -375,7 +375,7 @@
" yn = -x + G(xn, mu)\n",
" return xn, yn\n",
"\n",
"plot(Gumowski_Mira, 0)"
"plot(Gumowski_Mira)"
]
},
{
Expand Down Expand Up @@ -409,7 +409,7 @@
" return p*x + g*zreal - om*y, \\\n",
" p*y - g*zimag + om*x\n",
"\n",
"plot(Symmetric_Icon, -2)"
"plot(Symmetric_Icon)"
]
},
{
Expand All @@ -431,7 +431,7 @@
"from holoviews.operation.datashader import datashade, dynspread\n",
"hv.extension('bokeh')\n",
"\n",
"dynspread(datashade(hv.Points(trajectory(Clifford, *(args(\"Clifford\")[5]))), \n",
"dynspread(datashade(hv.Points(trajectory(Clifford, *(args(\"Clifford\")[5][1:]))), \n",
" cmap=viridis[::-1]).options(width=400,height=400))"
]
},
Expand All @@ -450,7 +450,7 @@
"metadata": {},
"outputs": [],
"source": [
"dynspread(datashade(hv.Path([trajectory(Clifford, *(args(\"Clifford\")[5]))]), \n",
"dynspread(datashade(hv.Path([trajectory(Clifford, *(args(\"Clifford\")[5][1:]))]), \n",
" cmap=viridis[::-1]).options(width=400,height=400))"
]
},
Expand All @@ -473,7 +473,7 @@
" return datashade(hv.Points(trajectory(Clifford, x0, y0, a, b, c, d, n)), \n",
" cmap=inferno[::-1], dynamic=False)\n",
"\n",
"x0,y0,a,b,c,d = args(\"Clifford\")[6]\n",
"x0,y0,a,b,c,d = args(\"Clifford\")[6][1:]\n",
"\n",
"dm = hv.DynamicMap(hv_clif, kdims=['a', 'b', 'c', 'd'])\n",
"dm = dm.redim.range(a=(-2.0, 2.0), b=(-2.0,2.0), c=(-2.0,2.0), d=(-2.0,2.0))\n",
Expand Down
150 changes: 75 additions & 75 deletions examples/topics/attractors.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
- [Bedhead, 1, 1, -0.81, -0.92]
- [Bedhead, 1, 1, -0.64, 0.76]
- [Bedhead, 1, 1, 0.06, 0.98]
- [Bedhead, 1, 1, -0.67, 0.83]
- [Clifford, 0, 0, -1.3, -1.3, -1.8, -1.9]
- [Clifford, 0, 0, -1.4, 1.6, 1.0, 0.7]
- [Clifford, 0, 0, 1.7, 1.7, 0.6, 1.2]
- [Clifford, 0, 0, 1.7, 0.7, 1.4, 2.0]
- [Clifford, 0, 0, -1.7, 1.8, -1.9, -0.4]
- [Clifford, 0, 0, 1.1, -1.32, -1.03, 1.54]
- [Clifford, 0, 0, 0.77, 1.99, -1.31, -1.45]
- [Clifford, 0, 0, -1.9, -1.9, -1.9, -1.0]
- [Clifford, 0, 0, 0.75, 1.34, -1.93, 1.0]
- [Clifford, 0, 0, -1.32, -1.65, 0.74, 1.81]
- [Clifford, 0, 0, -1.6, 1.6, 0.7, -1.0]
- [Clifford, 0, 0, -1.7, 1.5, -0.5, 0.7]
- [De_Jong, 0, 0, -1.244, -1.251, -1.815, -1.908]
- [De_Jong, 0, 0, 1.7, 1.7, 0.6, 1.2]
- [De_Jong, 0, 0, 1.4, -2.3, 2.4, -2.1]
- [De_Jong, 0, 0, -2.7, -0.09, -0.86, -2.2]
- [De_Jong, 0, 0, -0.827, -1.637, 1.659, -0.943]
- [De_Jong, 0, 0, -2.24, 0.43, -0.65, -2.43]
- [De_Jong, 0, 0, 2.01, -2.53, 1.61, -0.33]
- [De_Jong, 0, 0, 1.4, 1.56, 1.4, -6.56]
- [Fractal_Dream, 0.1, 0.1, -0.966918, 2.879879, 0.765145, 0.744728]
- [Fractal_Dream, 0.1, 0.1, -2.8276, 1.2813, 1.9655, 0.597]
- [Fractal_Dream, 0.1, 0.1, -1.1554, -2.3419, -1.9799, 2.1828]
- [Fractal_Dream, 0.1, 0.1, -1.9956, -1.4528, -2.6206, 0.8517]
- [Gumowski_Mira, 0.1, 0.1, 0.0, 0.5, -0.75]
- [Gumowski_Mira, 0, 1, 0.008, 0.05, -0.496]
- [Gumowski_Mira, 0.1, 0.1, 0.0, 0.5, -0.7509]
- [Gumowski_Mira, 0, 1, 0.0, 0.5, -0.22]
- [Gumowski_Mira, 0, 1, 0.008, 0.05, -0.9]
- [Gumowski_Mira, 0, 1, 0.008, 0.05, -0.45]
- [Gumowski_Mira, 0.1, 0.1, 0.008, 0.05, 0.16]
- [Gumowski_Mira, 0, 0.5, 0.008, 0.05, -0.7]
- [Gumowski_Mira, 0.5, 0, 0.0, 0.05, -0.2]
- [Gumowski_Mira, 0.5, 0.5, 0.0, 0.05, -0.22]
- [Gumowski_Mira, 0, 0.5, 0.0, 0.05, -0.31]
- [Gumowski_Mira, 0, 0.5, 0.0, 0.05, -0.55]
- [Gumowski_Mira, 0.5, 0.5, 0.0, 0.05, -0.23]
- [Gumowski_Mira, 0.5, 0.5, 0.009, 0.05, 0.32]
- [Gumowski_Mira, 0.1, 0.1, 0.0, 0.5, -0.65]
- [Gumowski_Mira, 0.0, 0.5, 0.0, 0, -0.578]
- [Gumowski_Mira, 0.0, 0.5, 0.0, 0, -0.604]
- [Gumowski_Mira, 0.0, 0.5, 0.0, 0, 0.228]
- [Gumowski_Mira, 0.0, 0.5, 0.0, 0, -0.002]
- [Gumowski_Mira, 0.0, 0.5, 0.0, 0, -0.623]
- [Hopalong1, 0, 0, 2.0, 1.0, 0.0]
- [Hopalong1, 0, 0, -11.0, 0.05, 0.5]
- [Hopalong1, 0, 0, 2.0, 0.05, 2.0]
- [Hopalong1, 0, 0, 1.1, 0.5, 1.0]
- [Hopalong2, 0, 0, 7.17, 8.44, 2.56]
- [Hopalong2, 0, 0, 7.8, 0.13, 8.15]
- [Hopalong2, 0, 0, 9.7, 1.6, 7.9]
- [Svensson, 0, 0, 1.5, -1.8, 1.6, 0.9]
- [Svensson, 0, 0, -1.78, 1.29, -0.09, -1.18]
- [Svensson, 0, 0, -0.91, -1.29, -1.97, -1.56]
- [Svensson, 0, 0, 1.4, 1.56, 1.4, -6.56]
- [Symmetric_Icon, 0.01, 0.01, 1.8, 0.0, 1.0, 0.1, -1.93, 5]
- [Symmetric_Icon, 0.01, 0.01, 5.0, -1.0, 1.0, 0.188, -2.5, 5]
- [Symmetric_Icon, 0.01, 0.01, -1.0, 0.1, -0.82, 0.12, 1.56, 3]
- [Symmetric_Icon, 0.01, 0.01, 1.806, 0.0, 1.0, 0.0, -1.806, 5]
- [Symmetric_Icon, 0.01, 0.01, 10.0, -12.0, 1.0, 0.0, -2.195, 3]
- [Symmetric_Icon, 0.01, 0.01, -2.5, 0.0, 0.9, 0.0, 2.5, 3]
- [Symmetric_Icon, 0.01, 0.01, 3.0, -16.79, 1.0, 0.0, -2.05, 9]
- [Symmetric_Icon, 0.01, 0.01, 5.0, 1.5, 1.0, 0.0, -2.7, 6]
- [Symmetric_Icon, 0.01, 0.01, 1.0, -0.1, 0.167, 0.0, -2.08, 7]
- [Symmetric_Icon, 0.01, 0.01, 2.32, 0.0, 0.75, 0.0, -2.32, 5]
- [Symmetric_Icon, 0.01, 0.01, -2.0, 0.0, -0.5, 0.0, 2.6, 5]
- [Symmetric_Icon, 0.01, 0.01, 2.0, 0.2, 0.1, 0.0, -2.34, 5]
- [Symmetric_Icon, 0.01, 0.01, 2.0, 0.0, 1.0, 0.1, -1.86, 4]
- [Symmetric_Icon, 0.01, 0.01, -1.0, 0.1, -0.82, 0.0, 1.56, 3]
- [Symmetric_Icon, 0.01, 0.01, -1.0, 0.03, -0.8, 0.0, 1.455, 3]
- [Symmetric_Icon, 0.01, 0.01, -2.5, -0.1, 0.9, -0.15, 2.39, 16]
- [Clifford, bgy, 0, 0, -1.3, -1.3, -1.8, -1.9]
- [Clifford, bmw, 0, 0, -1.4, 1.6, 1.0, 0.7]
- [Clifford, bgyw, 0, 0, 1.7, 1.7, 0.6, 1.2]
- [Clifford, bmy, 0, 0, 1.7, 0.7, 1.4, 2.0]
- [Clifford, fire, 0, 0, -1.7, 1.8, -1.9, -0.4]
- [Clifford, gray, 0, 0, 1.1, -1.32, -1.03, 1.54]
- [Clifford, kgy, 0, 0, 0.77, 1.99, -1.31, -1.45]
- [Clifford, kbc, 0, 0, -1.9, -1.9, -1.9, -1.0]
- [Clifford, viridis, 0, 0, 0.75, 1.34, -1.93, 1.0]
- [Clifford, inferno, 0, 0, -1.32, -1.65, 0.74, 1.81]
- [Clifford, bgy, 0, 0, -1.6, 1.6, 0.7, -1.0]
- [Clifford, bmw, 0, 0, -1.7, 1.5, -0.5, 0.7]
- [De_Jong, kbc, 0, 0, -1.244, -1.251, -1.815, -1.908]
- [De_Jong, viridis, 0, 0, 1.7, 1.7, 0.6, 1.2]
- [De_Jong, inferno, 0, 0, 1.4, -2.3, 2.4, -2.1]
- [De_Jong, bgy, 0, 0, -2.7, -0.09, -0.86, -2.2]
- [De_Jong, bmw, 0, 0, -0.827, -1.637, 1.659, -0.943]
- [De_Jong, bgyw, 0, 0, -2.24, 0.43, -0.65, -2.43]
- [De_Jong, bmy, 0, 0, 2.01, -2.53, 1.61, -0.33]
- [De_Jong, fire, 0, 0, 1.4, 1.56, 1.4, -6.56]
- [Svensson, bmw, 0, 0, 1.5, -1.8, 1.6, 0.9]
- [Svensson, bgyw, 0, 0, -1.78, 1.29, -0.09, -1.18]
- [Svensson, bmy, 0, 0, -0.91, -1.29, -1.97, -1.56]
- [Svensson, fire, 0, 0, 1.4, 1.56, 1.4, -6.56]
- [Bedhead, kgy, 1, 1, -0.81, -0.92]
- [Bedhead, kbc, 1, 1, -0.64, 0.76]
- [Bedhead, viridis, 1, 1, 0.06, 0.98]
- [Bedhead, inferno, 1, 1, -0.67, 0.83]
- [Fractal_Dream, bgy, 0.1, 0.1, -0.966918, 2.879879, 0.765145, 0.744728]
- [Fractal_Dream, bmw, 0.1, 0.1, -2.8276, 1.2813, 1.9655, 0.597]
- [Fractal_Dream, bgyw, 0.1, 0.1, -1.1554, -2.3419, -1.9799, 2.1828]
- [Fractal_Dream, bmy, 0.1, 0.1, -1.9956, -1.4528, -2.6206, 0.8517]
- [Hopalong1, bgy, 0, 0, 2.0, 1.0, 0.0]
- [Hopalong1, bmw, 0, 0, -11.0, 0.05, 0.5]
- [Hopalong1, bgyw, 0, 0, 2.0, 0.05, 2.0]
- [Hopalong1, bmy, 0, 0, 1.1, 0.5, 1.0]
- [Hopalong2, gray, 0, 0, 7.17, 8.44, 2.56]
- [Hopalong2, kgy, 0, 0, 7.8, 0.13, 8.15]
- [Hopalong2, kbc, 0, 0, 9.7, 1.6, 7.9]
- [Gumowski_Mira, bgy, 0.1, 0.1, 0.0, 0.5, -0.75]
- [Gumowski_Mira, bmw, 0, 1, 0.008, 0.05, -0.496]
- [Gumowski_Mira, bgyw, 0.1, 0.1, 0.0, 0.5, -0.7509]
- [Gumowski_Mira, bmy, 0, 1, 0.0, 0.5, -0.22]
- [Gumowski_Mira, fire, 0, 1, 0.008, 0.05, -0.9]
- [Gumowski_Mira, gray, 0, 1, 0.008, 0.05, -0.45]
- [Gumowski_Mira, kgy, 0.1, 0.1, 0.008, 0.05, 0.16]
- [Gumowski_Mira, kbc, 0, 0.5, 0.008, 0.05, -0.7]
- [Gumowski_Mira, viridis, 0.5, 0, 0.0, 0.05, -0.2]
- [Gumowski_Mira, inferno, 0.5, 0.5, 0.0, 0.05, -0.22]
- [Gumowski_Mira, bgy, 0, 0.5, 0.0, 0.05, -0.31]
- [Gumowski_Mira, bmw, 0, 0.5, 0.0, 0.05, -0.55]
- [Gumowski_Mira, bgyw, 0.5, 0.5, 0.0, 0.05, -0.23]
- [Gumowski_Mira, bmy, 0.5, 0.5, 0.009, 0.05, 0.32]
- [Gumowski_Mira, fire, 0.1, 0.1, 0.0, 0.5, -0.65]
- [Gumowski_Mira, gray, 0.0, 0.5, 0.0, 0, -0.578]
- [Gumowski_Mira, kgy, 0.0, 0.5, 0.0, 0, -0.604]
- [Gumowski_Mira, kbc, 0.0, 0.5, 0.0, 0, 0.228]
- [Gumowski_Mira, viridis, 0.0, 0.5, 0.0, 0, -0.002]
- [Gumowski_Mira, inferno, 0.0, 0.5, 0.0, 0, -0.623]
- [Symmetric_Icon, viridis, 0.01, 0.01, 1.8, 0.0, 1.0, 0.1, -1.93, 5]
- [Symmetric_Icon, inferno, 0.01, 0.01, 5.0, -1.0, 1.0, 0.188, -2.5, 5]
- [Symmetric_Icon, bgy, 0.01, 0.01, -1.0, 0.1, -0.82, 0.12, 1.56, 3]
- [Symmetric_Icon, bmw, 0.01, 0.01, 1.806, 0.0, 1.0, 0.0, -1.806, 5]
- [Symmetric_Icon, bgyw, 0.01, 0.01, 10.0, -12.0, 1.0, 0.0, -2.195, 3]
- [Symmetric_Icon, bmy, 0.01, 0.01, -2.5, 0.0, 0.9, 0.0, 2.5, 3]
- [Symmetric_Icon, fire, 0.01, 0.01, 3.0, -16.79, 1.0, 0.0, -2.05, 9]
- [Symmetric_Icon, gray, 0.01, 0.01, 5.0, 1.5, 1.0, 0.0, -2.7, 6]
- [Symmetric_Icon, kgy, 0.01, 0.01, 1.0, -0.1, 0.167, 0.0, -2.08, 7]
- [Symmetric_Icon, kbc, 0.01, 0.01, 2.32, 0.0, 0.75, 0.0, -2.32, 5]
- [Symmetric_Icon, viridis, 0.01, 0.01, -2.0, 0.0, -0.5, 0.0, 2.6, 5]
- [Symmetric_Icon, inferno, 0.01, 0.01, 2.0, 0.2, 0.1, 0.0, -2.34, 5]
- [Symmetric_Icon, bgy, 0.01, 0.01, 2.0, 0.0, 1.0, 0.1, -1.86, 4]
- [Symmetric_Icon, bmw, 0.01, 0.01, -1.0, 0.1, -0.82, 0.0, 1.56, 3]
- [Symmetric_Icon, bgyw, 0.01, 0.01, -1.0, 0.03, -0.8, 0.0, 1.455, 3]
- [Symmetric_Icon, bmy, 0.01, 0.01, -2.5, -0.1, 0.9, -0.15, 2.39, 16]
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
'pyct[cmd]',
'scikit-image',
'bokeh',
'scipy'
'scipy',
'testpath<0.4' # temporary due to pip issue?
]

extras_require = {
Expand Down

0 comments on commit 660b78f

Please sign in to comment.