Dotplot kshedden rebased of 1294 #1681

Merged
merged 20 commits into from May 21, 2014

Projects

None yet

3 participants

@josef-pkt
Member

rebased version of pull #1294

Only one merge conflict in version0.6.rst

ready to merge if TravisCI is green in all pythons

@josef-pkt
Member

This is not on common py2 py3 codebase yet. Needs fixing for python 3

@coveralls

Coverage Status

Coverage increased (+0.2%) when pulling d3f1750 on josef-pkt:dotplot_kshedden_rebased into ede3157 on statsmodels:master.

@josef-pkt
Member

py3 compat is easy
python 2.6 doesn't have dictionary comprehension
(some changes could be reversed later, looks prettier without py 2.6 compatibility)

@coveralls

Coverage Status

Coverage increased (+0.2%) when pulling b92bddd on josef-pkt:dotplot_kshedden_rebased into ede3157 on statsmodels:master.

@josef-pkt josef-pkt commented on the diff May 21, 2014
statsmodels/graphics/dotplots.py
@@ -0,0 +1,453 @@
+import numpy as np
+from statsmodels.compat import range
+from . import utils
+
+
+def dot_plot(points, intervals=None, lines=None, sections=None,
+ styles=None, marker_props=None, line_props=None,
+ split_names=None, section_order=None, line_order=None,
+ stacked=False, styles_order=None, striped=False,
+ horizontal=True, ax=None):
+ """
+ Produce a dotplot similar in style to those in Cleveland's
+ "Visualizing Data" book. These are also known as "forest plots".
@josef-pkt
josef-pkt May 21, 2014 Member

summary line should be one line

@josef-pkt josef-pkt commented on the diff May 21, 2014
statsmodels/graphics/dotplots.py
+ dotplot.
+ stacked : boolean
+ If True, when multiple points or intervals are drawn on the
+ same line, they are offset from each other.
+ styles_order : array_like
+ If stacked=True, this is the order in which the point styles
+ on a given line are drawn from top to bottom (if horizontal
+ is True) or from left to right (if horiontal is False). If
+ None (default), the order is lexical.
+ striped : boolean
+ If True, every other line is enclosed in a shaded box.
+ horizontal : boolean
+ If True (default), the lines are drawn horizontally, otherwise
+ they are drawn vertically.
+ ax : matplotlib.axes
+ The axes on which the dotplot is drawn. If None, a new axes
@josef-pkt
josef-pkt May 21, 2014 Member

'a new figure is created' ?

@josef-pkt josef-pkt commented on the diff May 21, 2014
statsmodels/graphics/dotplots.py
+ ax : matplotlib.axes
+ The axes on which the dotplot is drawn. If None, a new axes
+ is created.
+
+ Returns
+ -------
+ fig : Figure
+ The figure given by `ax.figure` or a new instance.
+
+ Notes
+ -----
+ `points`, `intervals`, `lines`, `sections`, `styles` must all have
+ the same length whenever present.
+
+ Examples
+ --------
@josef-pkt
josef-pkt May 21, 2014 Member

docstring should have a working example that displays a plot in the docs

@coveralls

Coverage Status

Coverage increased (+0.2%) when pulling 2215682 on josef-pkt:dotplot_kshedden_rebased into ede3157 on statsmodels:master.

@josef-pkt josef-pkt merged commit bbb0f8d into statsmodels:master May 21, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@josef-pkt josef-pkt deleted the josef-pkt:dotplot_kshedden_rebased branch May 21, 2014
@josef-pkt josef-pkt added this to the 0.6 milestone May 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment