@@ -212,7 +212,7 @@ class Table(Artist):
212212
213213 FONTSIZE = 10
214214 AXESPAD = 0.02 # the border between the axes and table edge
215- AVAILABLECELLTYPES = {"default" : 0 , "scicell" : 1 }
215+ AVAILABLECELLTYPES = {"default" : Cell , "scicell" : SciCell }
216216
217217 def __init__ (self , ax , loc = None , bbox = None , ** kwargs ):
218218
@@ -249,10 +249,7 @@ def add_cell(self, row, col, *args, **kwargs):
249249 """ Add a cell to the table. """
250250 xy = (0 , 0 )
251251
252- if self .AVAILABLECELLTYPES [self ._cellType ] == 1 :
253- cell = SciCell (xy , * args , ** kwargs )
254- else :
255- cell = Cell (xy , * args , ** kwargs )
252+ cell = self .AVAILABLECELLTYPES [self .cellType ](xy , * args , ** kwargs )
256253
257254 cell .set_figure (self .figure )
258255 cell .set_transform (self .get_transform ())
@@ -503,9 +500,9 @@ def cellType(self, cellType):
503500 self ._cellType = cellType
504501
505502 else :
506-
503+ cellTypes = ', ' . join ([ k for k in self . AVAILABLECELLTYPES . keys ()])
507504 raise ValueError ('Unrecognized cellType %s; '
508- 'must be "default" or "scicell" ' % cellType )
505+ 'must be one of the following: %s ' % ( cellType , cellTypes ) )
509506
510507
511508def table (ax ,
@@ -527,8 +524,9 @@ def table(ax,
527524 Thanks to John Gill for providing the class and table.
528525 """
529526 if cellType is not None and cellType not in Table .AVAILABLECELLTYPES :
530- raise ValueError ('cellType must be "default" or "scicell" '
531- 'instead of %s ' % cellType )
527+ cellTypes = ', ' .join ([k for k in Table .AVAILABLECELLTYPES .keys ()])
528+ raise ValueError ('Unrecognized cellType %s; '
529+ 'must be one of the following: %s' % (cellType , cellTypes ))
532530
533531 # Check we have some cellText
534532 if cellText is None :
0 commit comments