Skip to content

Commit

Permalink
Fixed pep8 issues in table.py and test_table.py
Browse files Browse the repository at this point in the history
  • Loading branch information
David committed Mar 22, 2015
1 parent bb4e7d4 commit ef0a7d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
30 changes: 16 additions & 14 deletions lib/matplotlib/table.py
Expand Up @@ -146,6 +146,7 @@ def set_text_props(self, **kwargs):
'update the text properties with kwargs'
self._text.update(kwargs)


class ScientificCell(Cell):
"""
A subclass of Cell where vertical lines are ommitted.
Expand All @@ -155,10 +156,11 @@ class ScientificCell(Cell):
def get_path(self):
'Return a path where vertical lines are not drawn'
path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0],
[0.0, 0.0]],
[Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO,
[0.0, 0.0]],
[Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO,
Path.CLOSEPOLY],
readonly=True)
readonly=True
)
return path


Expand Down Expand Up @@ -251,7 +253,7 @@ def cellType(self):
@cellType.setter
def cellType(self, value):
if value is None:
pass # Leave as previously set
pass # Leave as previously set
elif value in self.CELLTYPES:
self._cellType = value
else:
Expand Down Expand Up @@ -284,8 +286,8 @@ def draw(self, renderer):
keys.sort()
for key in keys:
self._cells[key].draw(renderer)
#for c in self._cells.itervalues():
# c.draw(renderer)
# for c in self._cells.itervalues():
# c.draw(renderer)
renderer.close_group('table')

def _get_grid_bbox(self, renderer):
Expand All @@ -311,8 +313,8 @@ def contains(self, mouseevent):
# doesn't have to bind to each one individually.
if self._cachedRenderer is not None:
boxes = [self._cells[pos].get_window_extent(self._cachedRenderer)
for pos in six.iterkeys(self._cells)
if pos[0] >= 0 and pos[1] >= 0]
for pos in six.iterkeys(self._cells)
if pos[0] >= 0 and pos[1] >= 0]
bbox = Bbox.union(boxes)
return bbox.contains(mouseevent.x, mouseevent.y), {}
else:
Expand Down Expand Up @@ -493,12 +495,12 @@ def get_celld(self):


def table(ax,
cellText=None, cellColours=None,
cellLoc='right', colWidths=None,
rowLabels=None, rowColours=None, rowLoc='left',
colLabels=None, colColours=None, colLoc='center',
loc='bottom', bbox=None, cellType=None,
**kwargs):
cellText=None, cellColours=None,
cellLoc='right', colWidths=None,
rowLabels=None, rowColours=None, rowLoc='left',
colLabels=None, colColours=None, colLoc='center',
loc='bottom', bbox=None, cellType=None,
**kwargs):
"""
TABLE(cellText=None, cellColours=None,
cellLoc='right', colWidths=None,
Expand Down
7 changes: 4 additions & 3 deletions lib/matplotlib/tests/test_table.py
Expand Up @@ -80,18 +80,19 @@ def test_label_colours():
colLabels=['Header'] * dim,
loc='best')


@image_comparison(baseline_images=['table_types'],
extensions=['png'])
def test_table_types():
fig = plt.figure()
l1 = ["","t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
l1 = ["", "t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
l2 = ["DLI", 35, 38, 10, 22, 25, 85, 22]

ax1 = fig.add_subplot(4, 1, 1)
ax1.plot([1, 2, 3, 4, 5, 6])
ax1.table(
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
cellText = [l1, l2],
cellText=[l1, l2],
loc="upper center",
colLoc="center",
rowLoc="center",
Expand All @@ -101,7 +102,7 @@ def test_table_types():
ax2.plot([1, 2, 3, 4, 5, 6])
ax2.table(
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
cellText = [l1, l2],
cellText=[l1, l2],
loc="upper center",
colLoc="center",
rowLoc="center",
Expand Down

0 comments on commit ef0a7d5

Please sign in to comment.