17
17
from sage .structure .sage_object import SageObject
18
18
from matplotlib .cm import gist_rainbow , Greys
19
19
from sage .plot .matrix_plot import matrix_plot
20
+ from sage .matrix .constructor import Matrix
20
21
from sage .plot .text import text
21
22
from copy import copy
22
23
@@ -949,17 +950,11 @@ def matrix_of_variables(self):
949
950
for i in range (self ._n ) for j in range (self ._n )]
950
951
return MS (entries )
951
952
952
-
953
- ### documentation hack ###
954
- # this code makes the docs display the default
955
- # argument of color_table as "gist_rainbow"
956
- # instead of something like
957
- # <matplotlib.colors.LinearSegmentedColormap object at 0x7fc24f7e10a0>
958
953
gist_rainbow_copy = copy (gist_rainbow )
959
- class _ReprOverrideLinearSegmentedColormap (gist_rainbow_copy .__class__ ):
954
+ class ReprOverrideLinearSegmentedColormap (gist_rainbow_copy .__class__ ):
960
955
def __repr__ (self ):
961
- return "gist_rainbow"
962
- gist_rainbow_copy .__class__ = _ReprOverrideLinearSegmentedColormap
956
+ return "Matplotlib gist_rainbow colormap "
957
+ gist_rainbow_copy .__class__ = ReprOverrideLinearSegmentedColormap
963
958
964
959
965
960
def color_table (self , element_names = True , cmap = gist_rainbow_copy , ** options ):
@@ -970,12 +965,11 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
970
965
971
966
- ``element_names`` - (default : ``True``) Whether to display text with element names on the image
972
967
973
- - ``cmap`` - (default : ``gist_rainbow``) matplotlib colour map object for plot
968
+ - ``cmap`` - (default : ``gist_rainbow``) colour map for plot, see matplotlib.cm
974
969
975
970
- ``**options`` - passed on to matrix_plot call
976
971
977
972
EXAMPLES::
978
-
979
973
sage: from sage.matrix.operation_table import OperationTable
980
974
sage: OTa = OperationTable(SymmetricGroup(3), operation=operator.mul)
981
975
sage: OTa.color_table()
@@ -989,7 +983,7 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
989
983
"""
990
984
991
985
# Base matrix plot object, without text
992
- plot = matrix_plot (self ._table , cmap = cmap ,
986
+ plot = matrix_plot (Matrix ( self ._table ) , cmap = cmap ,
993
987
frame = False , ** options )
994
988
995
989
if element_names :
@@ -1020,13 +1014,6 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
1020
1014
return plot
1021
1015
1022
1016
def gray_table (self , ** options ):
1023
- r"""
1024
- See ``color_table`` - this uses a grey colour scheme instead of a colourful one.
1025
-
1026
- INPUT:
1027
-
1028
- - ``**options`` - passed on to ``color_table`` call
1029
- """
1030
1017
return self .color_table (cmap = Greys , ** options )
1031
1018
1032
1019
def _ascii_table (self ):
0 commit comments