#4884: [with patch; needs review] Make colormap handling better
-------------------------+--------------------------------------------------
Reporter: abergeron | Owner: abergeron
Type: enhancement | Status: assigned
Priority: major | Milestone: sage-3.4
Component: graphics | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by wdj):
I think this patch is a great idea. (In fact, I wonder if a similar
plot_help() and plot3d_help() function might be useful.)
However, after the patch is applied, using 3.2.2 on an amd64 ubuntu 8.10
machine, this test failure occurs:
{{{
w...@hera:~/sagefiles/sage-3.2.2$ ./sage -t
/home/wdj/sagefiles/sage-3.2.2/devel/sage-
density_plot/sage/plot/matrix_plot.py
sage -t "devel/sage-density_plot/sage/plot/matrix_plot.py"
**********************************************************************
File "/home/wdj/sagefiles/sage-3.2.2/devel/sage-
density_plot/sage/plot/matrix_plot.py", line 114:
sage: matrix_plot(random_matrix(RDF, 50), cmap='jolies')
Expected:
Traceback (most recent call last):
...
RuntimeError: Color map jolies not known
Got:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/sagedoctest.py", line
38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_3[10]>", line 1, in <module>
matrix_plot(random_matrix(RDF, Integer(50)), cmap='jolies')###line
114:
sage: matrix_plot(random_matrix(RDF, 50), cmap='jolies')
File "sage_object.pyx", line 92, in
sage.structure.sage_object.SageObject.__repr__
(sage/structure/sage_object.c:1082)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 685, in _repr_
self.show()
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 1039, in show
hgridlinesstyle=hgridlinesstyle)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 1176, in save
g._render_on_subplot(subplot)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/matrix_plot.py", line 54, in _render_on_subplot
cmap = get_cmap(options['cmap'])
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/misc.py", line 119, in get_cmap
raise RuntimeError, "Color map %s not known (type cmap_help() for
valid names)"%cmap
RuntimeError: Color map jolies not known (type cmap_help() for valid
names)
**********************************************************************
File "/home/wdj/sagefiles/sage-3.2.2/devel/sage-
density_plot/sage/plot/matrix_plot.py", line 119:
sage: matrix_plot(random_matrix(RDF, 50), cmap='mpl')
Expected:
Traceback (most recent call last):
...
RuntimeError: Color map mpl not known
Got:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/sagedoctest.py", line
38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/home/wdj/sagefiles/sage-3.2.2/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_3[11]>", line 1, in <module>
matrix_plot(random_matrix(RDF, Integer(50)), cmap='mpl')###line
119:
sage: matrix_plot(random_matrix(RDF, 50), cmap='mpl')
File "sage_object.pyx", line 92, in
sage.structure.sage_object.SageObject.__repr__
(sage/structure/sage_object.c:1082)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 685, in _repr_
self.show()
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 1039, in show
hgridlinesstyle=hgridlinesstyle)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/plot.py", line 1176, in save
g._render_on_subplot(subplot)
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/matrix_plot.py", line 54, in _render_on_subplot
cmap = get_cmap(options['cmap'])
File "/home/wdj/sagefiles/sage-3.2.2/local/lib/python2.5/site-
packages/sage/plot/misc.py", line 119, in get_cmap
raise RuntimeError, "Color map %s not known (type cmap_help() for
valid names)"%cmap
RuntimeError: Color map mpl not known (type cmap_help() for valid
names)
**********************************************************************
1 items had failures:
2 of 16 in __main__.example_3
***Test Failed*** 2 failures.
For whitespace errors, see the file
/home/wdj/sagefiles/sage-3.2.2/tmp/.doctest_matrix_plot.py
[5.1 s]
exit code: 1024
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage-density_plot/sage/plot/matrix_plot.py"
Total time for all tests: 5.1 seconds
}}}
Am I missing something? Mybe I need a more recent version of Sage or ... ?
On the other hand, I love this helpful info:
{{{
sage: cmap_help()
A colormap can either be a string giving the name of a predefined
colormap,
a sequence of color describing a custom one, or an instance of a
matplotlib
Colormap.
The valid colormap names are:
Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu,
BuPu_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r,
OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1,
Pastel1_r, Pastel2, Pastel2_r,PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r,
PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r,
RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds,
Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r,
YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r,
autumn, autumn_r, binary, binary_r, bone, bone_r, cool, cool_r, copper,
copper_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r,
gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow,
gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gray,
gray_r, hot, hot_r, hsv, hsv_r, jet, jet_r, pink, pink_r, prism, prism_r,
spectral, spectral_r, spring, spring_r, summer, summer_r, winter,winter_r
If it is a list of colors, the colors can be specified by name, by a
3-tuple
of floats, or by an HTML hex color string.
The valid color names are:
blue, brown, gray, purple, grey, yellow, green, lightblue, orange, black,
white, automatic, red
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4884#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---