Skip to content

Commit

Permalink
add test for table cellEdgeColour(s) options
Browse files Browse the repository at this point in the history
  • Loading branch information
swfiua committed Mar 15, 2017
1 parent 83d95f1 commit 57c1aef
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions lib/matplotlib/tests/test_table.py
Expand Up @@ -9,6 +9,7 @@

from matplotlib.table import CustomCell
from matplotlib.path import Path
from matplotlib.colors import Normalize


def test_non_square():
Expand Down Expand Up @@ -182,3 +183,40 @@ def test_auto_column():
tb4.auto_set_font_size(False)
tb4.set_fontsize(12)
tb4.auto_set_column_width("-101")


@image_comparison(baseline_images=['table_edge_colour'],
extensions=['png'])
def test_edge_colour():

fig = plt.figure()

#iteratble list input
ax1 = fig.add_subplot(4, 1, 1)
ax1.axis('off')

data = [
[1, 10, 100],
[2, 40, 50],
[1, 10, 80],
[4, 20, 60]]

norm = Normalize()
colours = plt.cm.RdYlGn(norm(data))

alpha = 0.2
colours[:, :, 3] = alpha
ax1.table(
cellText=data,
cellColours=colours,
cellEdgeColours=colours,
loc='best')

ax2 = fig.add_subplot(4, 1, 2)
ax2.axis('off')

ax2.table(
cellText=data,
cellColours=colours,
cellEdgeColour='#cccccc',
loc='best')

0 comments on commit 57c1aef

Please sign in to comment.