Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameters to histogram #1249

Merged
merged 27 commits into from
May 12, 2021
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ff8c2a4
add parameters to histogram.py
willschlitzer Apr 29, 2021
db6fe5c
Merge branch 'master' into parameters-histogram
willschlitzer May 4, 2021
9fb74ae
Apply suggestions from code review
willschlitzer May 4, 2021
97e46dc
Merge branch 'master' into parameters-histogram
willschlitzer May 5, 2021
fe13b38
add anotate docstring in histogram.py
willschlitzer May 5, 2021
552ab97
add barwidth docstring in histogram.py
willschlitzer May 5, 2021
aba75b6
style fix
willschlitzer May 5, 2021
a1ea5a3
add docstring for center, normal, cumulative
willschlitzer May 5, 2021
2d2df08
add docstring for step, type
willschlitzer May 5, 2021
d3fe05e
add docstring for extreme; wrap U/V/t
willschlitzer May 5, 2021
0e08ec7
Merge branch 'master' into parameters-histogram
willschlitzer May 5, 2021
37f9b4f
Apply suggestions from code review
willschlitzer May 6, 2021
45d6b1f
Apply suggestions from code review
willschlitzer May 7, 2021
a289d10
Merge branch 'master' into parameters-histogram
willschlitzer May 7, 2021
087f024
fixing parameter name, remove mention of "-w"
willschlitzer May 7, 2021
c01ca2a
remove part about calling normal multiple times
willschlitzer May 8, 2021
70fd79c
moving xy docstring
willschlitzer May 9, 2021
8d80c91
change the N parameter to "distribution"
willschlitzer May 9, 2021
a0d64f1
change the S parameter to "steps"
willschlitzer May 9, 2021
38d5335
Merge branch 'master' into parameters-histogram
willschlitzer May 9, 2021
a866f9d
Apply suggestions from code review
willschlitzer May 9, 2021
a59aedf
style fix
willschlitzer May 10, 2021
c5fda26
Update pygmt/src/histogram.py
willschlitzer May 11, 2021
49e2f40
change cumulative docstring
willschlitzer May 11, 2021
2f2b572
change docstring order
willschlitzer May 11, 2021
5920e93
Update pygmt/src/histogram.py
willschlitzer May 11, 2021
e8b57d1
Merge branch 'master' into parameters-histogram
willschlitzer May 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 77 additions & 5 deletions pygmt/src/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@
A="horizontal",
B="frame",
C="cmap",
D="annotate",
E="barwidth",
F="center",
G="fill",
J="projection",
L="extreme",
N="distribution",
Q="cumulative",
R="region",
S="stairs",
T="series",
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="type",
c="panel",
l="label",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", T="sequence")
@kwargs_to_strings(R="sequence", T="sequence", c="sequence_comma", p="sequence")
def histogram(self, table, **kwargs):
r"""
Plots a histogram, and can read data from a file or
Expand All @@ -40,16 +53,75 @@ def histogram(self, table, **kwargs):
{G}
{W}
{c}
label : str
Add a legend entry for the symbol or line being plotted.
{p}
annotate : bool or str
[**+b**][**+f**\ *font*][**+o**\ *off*][**+r**].
Annotate each bar with the count it represents. Append any of the
following modifiers: Use **+b** to place the labels beneath the bars
instead of above; use **+f** to change to another font than the default
annotation font; use **+o** to change the offset between bar and
label [6p]; use **+r** to rotate the labels from horizontal to
vertical.
barwidth : int or float or str
*width*\ [**+o**\ *offset*].
Use an alternative histogram bar width than the default set via
``series``, and optionally shift all bars by an *offset*. Here
*width* is either an alternative width in data units, or the user may
append a valid plot dimension unit (**c**\|\ **i**\|\ **p**) for a
fixed dimension instead. Optionally, all bins may be shifted along the
axis by *offset*. As for *width*, it may be given in data units of
plot dimension units by appending the relevant unit.
center : bool
Center bin on each value. [Default is left edge].
distribution : bool or int or float or str
[*mode*][**+p**\ *pen*].
Draw the equivalent normal distribution; append desired
*pen* [Default is 0.25p,black].
The *mode* selects which central location and scale to use:

* 0 = mean and standard deviation [Default];
* 1 = median and L1 scale (1.4826 \* median absolute deviation; MAD);
* 2 = LMS (least median of squares) mode and scale.
cumulative : bool or str
[**r**].
Draw a cumulative histogram by passing ``True``. Use **r** to display
a reverse cumulative histogram.
extreme : str
**l**\|\ **h**\|\ **b**.
The modifiers specify the handling of extreme values that fall outside
the range set by ``series``. By default these values are ignored.
Append **b** to let these values be included in the first or last
bins. To only include extreme values below first bin into the first
bin, use **l**, and to only include extreme values above the last bin
into that last bin, use **h**.
stairs : bool
Draws a stairs-step diagram which does not include the internal bars
of the default histogram.
horizontal : bool
Plot the histogram using horizonal bars instead of the
default vertical bars.
series : int or str or list
[*min*\ /*max*\ /]\ *inc*\ [**+n**\ ]
[*min*\ /*max*\ /]\ *inc*\ [**+n**\ ].
Set the interval for the width of each bar in the histogram.
type : int or str
[*type*][**+w**].
Choose between 6 types of histograms:

* 0 = counts [Default]
* 1 = frequency_percent
* 2 = log (1.0 + count)
* 3 = log (1.0 + frequency_percent)
* 4 = log10 (1.0 + count)
* 5 = log10 (1.0 + frequency_percent).

To use weights provided as a second data column instead of pure counts,
append **+w**.
{XY}
{U}
{V}
label : str
Add a legend entry for the symbol or line being plotted.
{p}
{t}
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
with Session() as lib:
Expand Down