Multicolor mesh plot patch
Quentin Spencer <[email protected]> Mon, 26 Sep 2005 16:17:44 -0500
| Newsgroups | gmane.comp.gnu.octave.graphics,gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
I'm not sure which list is best for this, so I'm sending it to bug and graphics. Someone recently was complaining about the quality of mesh plots, and I agree the two-color plots don't look that great. I discovered that this can be changed quite easily using gnuplot 4.0 features. The attached patch makes mesh use color lines. It also defines a color palette that is very similar to Matlab's default palette. I don't know if this is the best way to do this, I'm open to suggestions on how to improve it. One thing that's missing is a check for whether the "palette" line type is valid. The octave-forge functions surf and surfc use a global gnuplot_has_pm3d, but it's a bit of a hack and I doubt John wants stuff like this in core Octave code. Is there any way to verify the capabilities of gnuplot from octave? We have things like OCTAVE_VERSION and OCTAVE_FORGE_VERSION defined, would it make sense to define GNUPLOT_VERSION? -Quentin
patch
(text/plain, 803 B)
Index: mesh.m
===================================================================
RCS file: /cvs/octave/scripts/plot/mesh.m,v
retrieving revision 1.31
diff -u -r1.31 mesh.m
--- a/mesh.m 15 Jun 2005 03:49:23 -0000 1.31
+++ b/mesh.m 26 Sep 2005 20:54:59 -0000
@@ -75,7 +75,10 @@
__gnuplot_raw__ ("set nologscale;\n");
__gnuplot_set__ parametric;
__gnuplot_raw__ ("set view 60, 30, 1, 1;\n");
- __gnuplot_splot__ (zz);
+ __gnuplot_set__ palette defined ( 0 "dark-blue", 1 "blue", ...
+ 2 "cyan", 3 "yellow", 4 "red" , 5 "dark-red" )
+ __gnuplot_set__ nocolorbox
+ __gnuplot_splot__ zz with line palette;
__gnuplot_set__ noparametric;
else
msg = "mesh: rows (z) must be the same as length (y) and";