Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

column headers now row -1 of the table#14544

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
swfiua wants to merge1 commit intomatplotlib:masterfromswfiua:colheadersnafu
Closed
Changes fromall commits
Commits
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
18 changes: 9 additions & 9 deletionslib/matplotlib/table.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -429,9 +429,12 @@ def _get_grid_bbox(self, renderer):
"""Get a bbox, in axes co-ordinates for the cells.

Only include those in the range (0,0) to (maxRow, maxCol)"""
start_row = 0
if self.has_column_labels:
start_row = -1
boxes = [cell.get_window_extent(renderer)
for (row, col), cell in self._cells.items()
if row >=0 and col >= 0]
if row >=start_row and col >= 0]
bbox = Bbox.union(boxes)
return bbox.inverse_transformed(self.get_transform())

Expand DownExpand Up@@ -787,14 +790,9 @@ def table(ax,
if len(rowLabels) != rows:
raise ValueError("'rowLabels' must be of length {0}".format(rows))

# If we have column labels, need to shift
# the text and colour arrays down 1 row
offset = 1
if colLabels is None:
if colColours is not None:
colLabels = [''] * cols
else:
offset = 0
elif colColours is None:
colColours = 'w' * cols

Expand All@@ -810,23 +808,25 @@ def table(ax,
# Add the cells
for row in range(rows):
for col in range(cols):
table.add_cell(row + offset, col,
table.add_cell(row, col,
width=colWidths[col], height=height,
text=cellText[row][col],
facecolor=cellColours[row][col],
loc=cellLoc)
# Do column labels
table.has_column_labels = False
if colLabels is not None:
table.has_column_labels = True
for col in range(cols):
table.add_cell(0, col,
table.add_cell(-1, col,
width=colWidths[col], height=height,
text=colLabels[col], facecolor=colColours[col],
loc=colLoc)

# Do row labels
if rowLabels is not None:
for row in range(rows):
table.add_cell(row + offset, -1,
table.add_cell(row, -1,
width=rowLabelWidth or 1e-15, height=height,
text=rowLabels[row], facecolor=rowColours[row],
loc=rowLoc)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp