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
21
20
from sage .plot .text import text
22
21
from sage .all import copy
23
22
@@ -950,11 +949,17 @@ def matrix_of_variables(self):
950
949
for i in range (self ._n ) for j in range (self ._n )]
951
950
return MS (entries )
952
951
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>
953
958
gist_rainbow_copy = copy (gist_rainbow )
954
- class ReprOverrideLinearSegmentedColormap (gist_rainbow_copy .__class__ ):
959
+ class _ReprOverrideLinearSegmentedColormap (gist_rainbow_copy .__class__ ):
955
960
def __repr__ (self ):
956
- return "Matplotlib gist_rainbow colormap "
957
- gist_rainbow_copy .__class__ = ReprOverrideLinearSegmentedColormap
961
+ return "gist_rainbow"
962
+ gist_rainbow_copy .__class__ = _ReprOverrideLinearSegmentedColormap
958
963
959
964
960
965
def color_table (self , element_names = True , cmap = gist_rainbow_copy , ** options ):
@@ -965,11 +970,12 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
965
970
966
971
- ``element_names`` - (default : ``True``) Whether to display text with element names on the image
967
972
968
- - ``cmap`` - (default : ``gist_rainbow``) colour map for plot, see matplotlib.cm
973
+ - ``cmap`` - (default : ``gist_rainbow``) matplotlib colour map object for plot
969
974
970
975
- ``**options`` - passed on to matrix_plot call
971
976
972
977
EXAMPLES::
978
+
973
979
sage: from sage.matrix.operation_table import OperationTable
974
980
sage: OT = OperationTable(SymmetricGroup(3), operation=operator.mul)
975
981
sage: OT.color_table()
@@ -978,7 +984,7 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
978
984
"""
979
985
980
986
# Base matrix plot object, without text
981
- plot = matrix_plot (Matrix ( self ._table ) , cmap = cmap ,
987
+ plot = matrix_plot (self ._table , cmap = cmap ,
982
988
frame = False , ** options )
983
989
984
990
if element_names :
@@ -1009,6 +1015,13 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
1009
1015
return plot
1010
1016
1011
1017
def gray_table (self , ** options ):
1018
+ r"""
1019
+ See ``color_table`` - this uses a grey colour scheme instead of a colourful one.
1020
+
1021
+ INPUT:
1022
+
1023
+ - ``**options`` - passed on to ``color_table`` call
1024
+ """
1012
1025
return self .color_table (cmap = Greys , ** options )
1013
1026
1014
1027
def _ascii_table (self ):
0 commit comments