aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavi Merino <merino.jav@gmail.com>2016-11-05 13:14:53 -0600
committerJavi Merino <merino.jav@gmail.com>2016-11-05 13:14:53 -0600
commite62d764645d02c373cfee686ddac3de257aed6e3 (patch)
treefef5eec337a016a89599a1374aed2f81d6b9c240
parent085a0264afaea1a03695d3950c5772bca7ba846e (diff)
parent74efec03188ebc15ea5d635fe7d4c5861f72f0d7 (diff)
downloadtrappy-e62d764645d02c373cfee686ddac3de257aed6e3.tar.gz
Merge pull request #229 from bjackman
Add fill_alpha param to ILinePlot
-rw-r--r--doc/InteractivePlotter.ipynb34
-rw-r--r--trappy/plotter/ILinePlot.py5
-rw-r--r--trappy/plotter/ILinePlotGen.py3
-rw-r--r--trappy/plotter/js/ILinePlot.js3
4 files changed, 43 insertions, 2 deletions
diff --git a/doc/InteractivePlotter.ipynb b/doc/InteractivePlotter.ipynb
index 01cc103..5ae8cc6 100644
--- a/doc/InteractivePlotter.ipynb
+++ b/doc/InteractivePlotter.ipynb
@@ -349,7 +349,39 @@
],
"language": "python",
"metadata": {},
- "outputs": []
+ "outputs": [],
+ "prompt_number": null
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Styling ILinePlots"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Use `fill=True` to colour-fill the space under the line. `fill_alpha` optionally sets the opacity."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "trappy.ILinePlot(\n",
+ " trace1,\n",
+ " signals=[\"thermal:temp\"],\n",
+ " fill=True,\n",
+ " fill_alpha=0.5\n",
+ ").view()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": null
},
{
"cell_type": "heading",
diff --git a/trappy/plotter/ILinePlot.py b/trappy/plotter/ILinePlot.py
index 722e2ae..9199a6c 100644
--- a/trappy/plotter/ILinePlot.py
+++ b/trappy/plotter/ILinePlot.py
@@ -83,6 +83,10 @@ class ILinePlot(AbstractDataPlotter):
:param fill: Fill the area under the plots
:type fill: bool
+ :param fill_alpha: Opacity of filled area under the plots.
+ Implies fill=True.
+ :type fill_alpha: float
+
:param xlim: A tuple representing the upper and lower xlimits
:type xlim: tuple
@@ -204,7 +208,6 @@ class ILinePlot(AbstractDataPlotter):
self._attr["drawstyle"] = None
self._attr["step_plot"] = False
self._attr["fill"] = AttrConf.FILL
- self._attr["draw_line"] = True
self._attr["scatter"] = AttrConf.PLOT_SCATTER
self._attr["point_size"] = AttrConf.POINT_SIZE
self._attr["map_label"] = {}
diff --git a/trappy/plotter/ILinePlotGen.py b/trappy/plotter/ILinePlotGen.py
index 1ec7204..2859a16 100644
--- a/trappy/plotter/ILinePlotGen.py
+++ b/trappy/plotter/ILinePlotGen.py
@@ -235,6 +235,9 @@ class ILinePlotGen(object):
fig_params["title"] = title
fig_params["step_plot"] = self._attr["step_plot"]
fig_params["fill_graph"] = self._attr["fill"]
+ if "fill_alpha" in self._attr:
+ fig_params["fill_alpha"] = self._attr["fill_alpha"]
+ fig_params["fill_graph"] = True
fig_params["per_line"] = self._attr["per_line"]
fig_params["height"] = self._attr["height"]
diff --git a/trappy/plotter/js/ILinePlot.js b/trappy/plotter/js/ILinePlot.js
index 54b6273..7967405 100644
--- a/trappy/plotter/js/ILinePlot.js
+++ b/trappy/plotter/js/ILinePlot.js
@@ -133,6 +133,9 @@ var ILinePlot = ( function() {
dateWindow: t_info.dateWindow
};
+ if (typeof t_info.fill_alpha !== 'undefined')
+ options.fillAlpha = t_info.fill_alpha;
+
if (typeof colors !== 'undefined')
options["colors"] = colors;