Skip to content

Commit ed974b6

Browse files
committed
Revert "improve imports + doc tweaks"
Keep this in tree for future reference: + ### documentation hack ### + # this code makes the docs display the default + # argument of color_table as "gist_rainbow" + # instead of something like + # <matplotlib.colors.LinearSegmentedColormap object at 0x...> This reverts commit f35951183ef8075630fb9fec79685d904b2b87fd.
1 parent 26e12bd commit ed974b6

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/sage/matrix/operation_table.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from sage.structure.sage_object import SageObject
1818
from matplotlib.cm import gist_rainbow, Greys
1919
from sage.plot.matrix_plot import matrix_plot
20+
from sage.matrix.constructor import Matrix
2021
from sage.plot.text import text
2122
from copy import copy
2223

@@ -949,17 +950,11 @@ def matrix_of_variables(self):
949950
for i in range(self._n) for j in range(self._n)]
950951
return MS(entries)
951952

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>
958953
gist_rainbow_copy=copy(gist_rainbow)
959-
class _ReprOverrideLinearSegmentedColormap(gist_rainbow_copy.__class__):
954+
class ReprOverrideLinearSegmentedColormap(gist_rainbow_copy.__class__):
960955
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
963958

964959

965960
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):
970965
971966
- ``element_names`` - (default : ``True``) Whether to display text with element names on the image
972967
973-
- ``cmap`` - (default : ``gist_rainbow``) matplotlib colour map object for plot
968+
- ``cmap`` - (default : ``gist_rainbow``) colour map for plot, see matplotlib.cm
974969
975970
- ``**options`` - passed on to matrix_plot call
976971
977972
EXAMPLES::
978-
979973
sage: from sage.matrix.operation_table import OperationTable
980974
sage: OTa = OperationTable(SymmetricGroup(3), operation=operator.mul)
981975
sage: OTa.color_table()
@@ -989,7 +983,7 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
989983
"""
990984

991985
# Base matrix plot object, without text
992-
plot = matrix_plot(self._table, cmap=cmap,
986+
plot = matrix_plot(Matrix(self._table), cmap=cmap,
993987
frame=False, **options)
994988

995989
if element_names:
@@ -1020,13 +1014,6 @@ def color_table(self, element_names=True, cmap=gist_rainbow_copy, **options):
10201014
return plot
10211015

10221016
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-
"""
10301017
return self.color_table(cmap=Greys, **options)
10311018

10321019
def _ascii_table(self):

0 commit comments

Comments
 (0)