Skip to content

Commit b5fda5e

Browse files
committed
Use numpydoc for docstrings
1 parent ced2579 commit b5fda5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+412
-345
lines changed

doc/_static/custom.css

+18
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,21 @@ table.dataframe thead th {
9090
table.dataframe tbody tr:nth-child(odd) {
9191
background: #F0F6F6;
9292
}
93+
94+
95+
/* Aesthetics table */
96+
97+
table.field-list dd table>tbody>tr>td,
98+
table.field-list dd table>tbody>tr>th,
99+
table.field-list dd table>tfoot>tr>td,
100+
table.field-list dd table>tfoot>tr>th,
101+
table.field-list dd table>thead>tr>td,
102+
table.field-list dd table>thead>tr>th {
103+
padding: 0.5em;
104+
}
105+
106+
/* Computed aesthetics */
107+
108+
.content table.field-list dd>p.rubric {
109+
margin: 1.5em 0 1em;
110+
}

doc/conf.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
'sphinx.ext.ifconfig',
5454
'sphinx.ext.viewcode',
5555
'sphinx.ext.autosummary',
56-
'sphinx.ext.napoleon',
5756

5857
'sphinxext.examples_and_gallery',
5958
'sphinxext.inline_code_highlight',
6059

61-
'nbsphinx'
60+
'nbsphinx',
61+
'numpydoc',
6262
]
6363

6464
# Add any paths that contain templates here, relative to this directory.
@@ -410,6 +410,34 @@
410410
}
411411

412412

413+
numpydoc_show_class_members = False
414+
numpydoc_class_members_toctree = False
415+
numpydoc_xref_param_type = True
416+
numpydoc_xref_aliases = {
417+
# python
418+
'sequence': ':term:`python:sequence`',
419+
'iterable': ':term:`python:iterable`',
420+
'string': 'str',
421+
'tuples': 'tuple',
422+
'boolean': 'bool',
423+
# numpy
424+
'array': 'numpy.ndarray',
425+
'np.array': 'numpy.ndarray',
426+
'ndarray': 'numpy.ndarray',
427+
'array-like': ':term:`array-like<numpy:array_like>`',
428+
'array_like': ':term:`numpy:array_like`',
429+
# pandas
430+
'dataframe': 'pandas.DataFrame',
431+
'DataFrame': 'pandas.DataFrame',
432+
'Series': 'pandas.Series',
433+
'series': 'pandas.Series',
434+
# plotnine
435+
'geom': ':term:`geom`',
436+
'stat': ':term:`stat`',
437+
'position': ':term:`position`',
438+
}
439+
440+
413441
def link_to_tutorials():
414442
# Linking to the directory does not work well with
415443
# nbsphinx. We link to the files themselves

doc/glossary.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. currentmodule:: plotnine
2+
3+
.. _glossary:
4+
5+
Glossary of Common Terms
6+
========================
7+
8+
.. glossary::
9+
10+
stat
11+
A subclass of :class:`~plotnine.stats.stat.stat`.
12+
13+
geom
14+
A subclass of :class:`~plotnine.geoms.geom.geom`.
15+
16+
position
17+
A subclass of :class:`~plotnine.positions.position.position`.

doc/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Documentation
3939
changelog
4040
about-plotnine
4141
tutorials
42+
glossary
4243
external-resources
4344

4445
.. _ggplot2: http://ggplot2.org

doc/theme/layout.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "basic/layout.html" %}
22

33
{% if theme_bootstrap_version == "3" %}
4-
{% set bootstrap_version, navbar_version = "3.3.6", "" %}
4+
{% set bootstrap_version, navbar_version = "3.3.7", "" %}
55
{% set bs_span_prefix = "col-md-" %}
66
{% else %}
77
{% set bootstrap_version, navbar_version = "2.3.2", "-2" %}

doc/theme/static/bootstrap-3.3.6/css/bootstrap.min.css

-5
This file was deleted.

doc/theme/static/bootstrap-3.3.6/js/bootstrap.min.js

-7
This file was deleted.

doc/theme/static/bootstrap-3.3.7/css/bootstrap.min.css

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/theme/static/bootstrap-3.3.7/js/bootstrap.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/theme/static/bootstrap-sphinx.css_t

+11-15
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,25 @@
99
* Imports to aggregate everything together.
1010
*/
1111

12-
@import url("basic.css");
12+
@import url("./basic.css");
1313

1414
{% if theme_bootstrap_version == "3" %}
15-
{% set bootstrap_version, bootstrap_additional_css = "3.3.6", "theme" %}
16-
{% set bs_span_prefix = "col-md-" %}
15+
{% set bootstrap_version, bootstrap_additional_css = "3.3.7", "theme" %}
1716
{% else %}
1817
{% set bootstrap_version, bootstrap_additional_css = "2.3.2", "responsive" %}
19-
{% set bs_span_prefix = "span" %}
2018
{% endif %}
2119

2220
{% if theme_bootswatch_theme and theme_bootswatch_theme != "\"\"" %}
2321
{# BS2 needs "bootstrap-responsive.css". BS3 doesn't. #}
2422
{% if theme_bootstrap_version == "3" %}
25-
@import url("{{ 'bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css' }}");
23+
@import url("{{ './bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css' }}");
2624
{% else %}
27-
@import url("{{ 'bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css' }}");
28-
@import url("{{ 'bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css' }}");
25+
@import url("{{ './bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css' }}");
26+
@import url("{{ './bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css' }}");
2927
{% endif %}
3028
{% else %}
31-
@import url("{{ 'bootstrap-' + bootstrap_version + '/css/bootstrap.min.css' }}");
32-
@import url("{{ 'bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css' }}");
33-
{% endif %}
34-
35-
{% if bootswatch_css_custom %}
36-
{%- for css_custom in bootswatch_css_custom %}
37-
@import url("{{ css_custom }}");
38-
{%- endfor %}
29+
@import url("{{ './bootstrap-' + bootstrap_version + '/css/bootstrap.min.css' }}");
30+
@import url("{{ './bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css' }}");
3931
{% endif %}
4032

4133
/*
@@ -125,6 +117,10 @@ div.highlight {
125117
background: none;
126118
}
127119

120+
a.headerlink {
121+
margin-left: 0.25em;
122+
}
123+
128124
a.footnote-reference {
129125
vertical-align: super;
130126
font-size: 75%;

doc/theme/static/bootstrap-sphinx.js_t

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898
// Enlarge content if sidebar is larger.
9999
if ($sideBar.outerHeight(true) > $content.outerHeight(true)) {
100-
$content.minHeight($sideBar.outerHeight(true));
100+
$content.css("min-height", $sideBar.outerHeight(true));
101101
}
102102

103103
$sideBar

doc/theme/theme.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ source_link_position = nav
5353
# Bootswatch (http://bootswatch.com/) theme.
5454
#
5555
# Options are nothing (default) or the name of a valid theme such as
56-
# "amelia" or "cosmo".
56+
# "cosmo" or "sandstone".
5757
bootswatch_theme =
5858

5959
# Switch Bootstrap version?

plotnine/aes.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ class aes(dict):
3636
x aesthetic mapping
3737
y : str | array_like | scalar | str-expression
3838
y aesthetic mapping
39-
40-
**kwargs : dict
39+
\*\*kwargs : dict
4140
Other aesthetic mappings
4241
42+
Notes
43+
-----
44+
Only the **x** and **y** aesthetic mappings can be specified as
45+
positional arguments. All the rest must be keyword arguments.
4346
44-
The value of each mapping must be one of;
47+
The value of each mapping must be one of:
4548
4649
- **string**::
4750
@@ -111,10 +114,6 @@ class aes(dict):
111114
groups are sufficient. However, there may be cases were it is
112115
handy to map to it.
113116
114-
Note
115-
----
116-
Only the **x** and **y** aesthetic mappings can be specified as
117-
positional arguments. All the rest must be keyword arguments.
118117
"""
119118

120119
def __init__(self, *args, **kwargs):
@@ -363,8 +362,8 @@ def is_valid_aesthetic(value, ae):
363362
out : bool
364363
Whether the value is of a valid looking form.
365364
366-
Note
367-
----
365+
Notes
366+
-----
368367
There are no guarantees that he value is spot on
369368
valid.
370369
"""

plotnine/animation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class PlotnineAnimation(ArtistAnimation):
2626
Controls whether blitting is used to optimize drawing. Defaults
2727
to `False`.
2828
29-
Note
30-
----
29+
Notes
30+
-----
3131
1. The plots should have the same `facet` and
3232
the facet should not have fixed x and y scales.
3333
2. The scales of all the plots should have the same limits. It is

plotnine/coords/coord.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def setup_layout(self, layout):
6868
layout dataframe altered to according to the requirements
6969
of the coordinate system.
7070
71-
Note
72-
----
71+
Notes
72+
-----
7373
The input dataframe may be changed.
7474
"""
7575
return layout

plotnine/coords/coord_fixed.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class coord_fixed(coord_cartesian):
2323
some factor. If `False`, use the limits
2424
from the data.
2525
26-
Note
27-
----
26+
Notes
27+
-----
2828
To specify aspect ratio of the visual size for the axes use the
2929
:class:`~plotnine.themes.themeable.aspect_ratio` themeable::
3030

0 commit comments

Comments
 (0)