Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3249f50

Browse files
committed
Fixed whitespace, added constructor to SciCell
1 parent 9eb3204 commit 3249f50

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

lib/matplotlib/table.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,29 @@ def set_text_props(self, **kwargs):
145145
'update the text properties with kwargs'
146146
self._text.update(kwargs)
147147

148+
148149
class SciCell(Cell):
149-
150+
"""
151+
A SciCell is a Cell, but it only draws the horizontal lines of the Cell
152+
153+
"""
154+
155+
def __init__(self, *args, **kwargs):
156+
157+
# Call base
158+
Cell.__init__(self, *args, **kwargs)
159+
150160
@allow_rasterization
151161
def draw(self, renderer):
152162
if not self.get_visible():
153163
return
154-
164+
155165
bbox = Rectangle.get_bbox(self)
156166
x, y, w, h = bbox.bounds
157167

158-
topLineVertices = [[x, y],[x + w, y]]
159-
botLineVertices = [[x, y + h],[x + w, y + h]]
160-
168+
topLineVertices = [[x, y], [x + w, y]]
169+
botLineVertices = [[x, y + h], [x + w, y + h]]
170+
161171
topLine = Polygon(topLineVertices)
162172
botLine = Polygon(botLineVertices)
163173

@@ -171,6 +181,7 @@ def draw(self, renderer):
171181
self._set_text_position(renderer)
172182
self._text.draw(renderer)
173183

184+
174185
class Table(Artist):
175186
"""
176187
Create a table of cells.
@@ -492,7 +503,7 @@ def set_cell_type(self, cellType):
492503

493504
else:
494505
raise ValueError('Unrecognized cell type %s; '
495-
'try default or scicell' % cellType)
506+
'Has to be default or scicell' % cellType)
496507

497508

498509
def table(ax,
@@ -573,7 +584,7 @@ def table(ax,
573584
# Now create the table
574585
table = Table(ax, loc, bbox, **kwargs)
575586
height = table._approx_text_height()
576-
587+
577588
if cellType is not None:
578589
table.set_cell_type(cellType)
579590

0 commit comments

Comments
 (0)