Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3432b7a

Browse filesBrowse files
committed
DOC: Fix colLoc default
- fix colLoc default - make docs in table.py conform to numpydoc - move setting default value of loc of Cell from code to signature
1 parent 103ca38 commit 3432b7a
Copy full SHA for 3432b7a

File tree

Expand file treeCollapse file tree

3 files changed

+22
-17
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+22
-17
lines changed
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*loc* parameter of ``Cell`` doesn't accept ``None`` anymore
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The default value of the *loc* parameter has been changed from ``None`` to ``right``,
5+
which already was the default location. The behavior of `.Cell` didn't change when
6+
called without an explicit *loc* parameter.

‎lib/matplotlib/table.py

Copy file name to clipboardExpand all lines: lib/matplotlib/table.py
+15-16Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, xy, width, height, *,
5757
edgecolor='k', facecolor='w',
5858
fill=True,
5959
text='',
60-
loc=None,
60+
loc='right',
6161
fontproperties=None,
6262
visible_edges='closed',
6363
):
@@ -70,20 +70,21 @@ def __init__(self, xy, width, height, *,
7070
The cell width.
7171
height : float
7272
The cell height.
73-
edgecolor : color
73+
edgecolor : color, default: 'k'
7474
The color of the cell border.
75-
facecolor : color
75+
facecolor : color, default: 'w'
7676
The cell facecolor.
77-
fill : bool
77+
fill : bool, default: True
7878
Whether the cell background is filled.
79-
text : str
79+
text : str, optional
8080
The cell text.
81-
loc : {'left', 'center', 'right'}, default: 'right'
81+
loc : {'right', 'center', 'left'}
8282
The alignment of the text within the cell.
83-
fontproperties : dict
83+
fontproperties : dict, optional
8484
A dict defining the font properties of the text. Supported keys and
8585
values are the keyword arguments accepted by `.FontProperties`.
86-
visible_edges : str, default: 'closed'
86+
visible_edges : {'closed', 'open', 'horizontal', 'vertical'} or \
87+
substring of 'BRTL'
8788
The cell edges to be drawn with a line: a substring of 'BRTL'
8889
(bottom, right, top, left), or one of 'open' (no edges drawn),
8990
'closed' (all edges drawn), 'horizontal' (bottom and top),
@@ -97,8 +98,6 @@ def __init__(self, xy, width, height, *,
9798
self.visible_edges = visible_edges
9899

99100
# Create text object
100-
if loc is None:
101-
loc = 'right'
102101
self._loc = loc
103102
self._text = Text(x=xy[0], y=xy[1], clip_on=False,
104103
text=text, fontproperties=fontproperties,
@@ -283,7 +282,7 @@ def __init__(self, ax, loc=None, bbox=None, **kwargs):
283282
----------
284283
ax : `~matplotlib.axes.Axes`
285284
The `~.axes.Axes` to plot the table into.
286-
loc : str
285+
loc : str, optional
287286
The position of the cell with respect to *ax*. This must be one of
288287
the `~.Table.codes`.
289288
bbox : `.Bbox` or [xmin, ymin, width, height], optional
@@ -685,7 +684,7 @@ def table(ax,
685684
cellColours : 2D list of colors, optional
686685
The background colors of the cells.
687686
688-
cellLoc : {'left', 'center', 'right'}, default: 'right'
687+
cellLoc : {'right', 'center', 'left'}
689688
The alignment of the text within the cells.
690689
691690
colWidths : list of float, optional
@@ -698,7 +697,7 @@ def table(ax,
698697
rowColours : list of colors, optional
699698
The colors of the row header cells.
700699
701-
rowLoc : {'left', 'center', 'right'}, default: 'left'
700+
rowLoc : {'left', 'center', 'right'}
702701
The text alignment of the row header cells.
703702
704703
colLabels : list of str, optional
@@ -707,18 +706,18 @@ def table(ax,
707706
colColours : list of colors, optional
708707
The colors of the column header cells.
709708
710-
colLoc : {'left', 'center', 'right'}, default: 'left'
709+
colLoc : {'center', 'left', 'right'}
711710
The text alignment of the column header cells.
712711
713-
loc : str, optional
712+
loc : str, default: 'bottom'
714713
The position of the cell with respect to *ax*. This must be one of
715714
the `~.Table.codes`.
716715
717716
bbox : `.Bbox` or [xmin, ymin, width, height], optional
718717
A bounding box to draw the table into. If this is not *None*, this
719718
overrides *loc*.
720719
721-
edges : substring of 'BRTL' or {'open', 'closed', 'horizontal', 'vertical'}
720+
edges : {'closed', 'open', 'horizontal', 'vertical'} or substring of 'BRTL'
722721
The cell edges to be drawn with a line. See also
723722
`~.Cell.visible_edges`.
724723

‎lib/matplotlib/table.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/table.pyi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Cell(Rectangle):
2222
facecolor: ColorType = ...,
2323
fill: bool = ...,
2424
text: str = ...,
25-
loc: Literal["left", "center", "right"] | None = ...,
25+
loc: Literal["left", "center", "right"] = ...,
2626
fontproperties: dict[str, Any] | None = ...,
2727
visible_edges: str | None = ...
2828
) -> None: ...

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.