Skip to content

Tables with open edges do not color table cells #20100

Open
@K20shores

Description

@K20shores

Bug report

Bug summary

Specifying edges=open and including colors through cellColours will result in a table without any colors.

Code for reproduction

fig, ax = plt.subplots(dpi=300)

ax.axis('off')
ax.axis('tight')

even_color='#9CDEF6'
odd_color='#6549DA'

cell_text = [[0.2] * 3, [0.1] * 3, [0.3] * 3]

labels=['Linear Regression', 'Bayesian Ridge', 'MARS']
columns = ['$R^2$', 'MAE', 'RMSE']

cell_colors = [[even_color] * len(columns) if i % 2 == 0 else [odd_color] * len(columns) for i in range(len(cell_text))]

table = ax.table(cellText=cell_text,
                      rowLabels=labels,
                      cellColours = cell_colors,
                      colLabels=columns,
                      loc='best', edges='open', cellLoc='center')

Actual outcome

image

Expected outcome

Cell colors should be applied to cells even if the table cell edges are set to open. Like the table below, but without the ugly cell lines.

image

Matplotlib version

  • Operating system:
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.3.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.9.4
  • Jupyter version (if applicable): core-4.7.0, notebook-6.2.0
  • Other libraries:

Installed through pip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions