Skip to content

Commit 2366b88

Browse files
Figure.histogram: Deprecate parameter barwidth to bar_width (Will be removed in v0.20.0) (#4279)
1 parent 7ea183a commit 2366b88

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

examples/tutorials/advanced/cartesian_histograms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
# Grouped bars
321321
# ------------
322322
#
323-
# By setting the ``barwidth`` parameter in respect to the values passed to the
323+
# By setting the ``bar_width`` parameter in respect to the values passed to the
324324
# ``series`` parameter histograms with grouped bars can be created.
325325
#
326326
# Limitations of histograms with grouped bars are:
@@ -347,7 +347,7 @@
347347
# of the bin width
348348
# Offset ("+o") the bars to align each bar with the left limit of the corresponding
349349
# bin
350-
barwidth=f"{binwidth / 2}+o-{binwidth / 4}",
350+
bar_width=f"{binwidth / 2}+o-{binwidth / 4}",
351351
label="data01",
352352
)
353353

@@ -358,7 +358,7 @@
358358
fill="orange",
359359
pen="1p,darkgray,solid",
360360
histtype=0,
361-
barwidth=f"{binwidth / 2}+o{binwidth / 4}",
361+
bar_width=f"{binwidth / 2}+o{binwidth / 4}",
362362
label="data02",
363363
)
364364

pygmt/src/histogram.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,22 @@
88
from pygmt._typing import PathLike, TableLike
99
from pygmt.alias import AliasSystem
1010
from pygmt.clib import Session
11-
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
11+
from pygmt.helpers import (
12+
build_arg_list,
13+
deprecate_parameter,
14+
fmt_docstring,
15+
kwargs_to_strings,
16+
use_alias,
17+
)
1218

1319

1420
@fmt_docstring
21+
@deprecate_parameter("barwidth", "bar_width", "v0.18.0", remove_version="v0.20.0")
1522
@use_alias(
1623
A="horizontal",
1724
C="cmap",
1825
D="annotate",
19-
E="barwidth",
26+
E="bar_width",
2027
F="center",
2128
G="fill",
2229
L="extreme",
@@ -84,7 +91,7 @@ def histogram(
8491
annotation font; use **+o** to change the offset between bar and
8592
label [Default is ``"6p"``]; use **+r** to rotate the labels from
8693
horizontal to vertical.
87-
barwidth : float or str
94+
bar_width : float or str
8895
*width*\ [**+o**\ *offset*].
8996
Use an alternative histogram bar width than the default set via
9097
``series``, and optionally shift all bars by an *offset*. Here

0 commit comments

Comments
 (0)