octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color "none" for figures


From: Shai Ayal
Subject: Re: color "none" for figures
Date: Sat, 20 Mar 2010 21:55:52 +0200

On Tue, Mar 16, 2010 at 11:04 PM, Thorsten Meyer <address@hidden> wrote:
>
> Thorsten Meyer wrote:
> > David Bateman wrote:
> >> Thorsten Meyer wrote:
> >>> Hi,
> >>>
> >>> attached is a little patch, which allows a value of "none" for the
> >>> "color"
> >>> property of a figure.
> >>> Example:
> >>> plot(1,1)
> >>> set(gcf, "color", [1 0 0]); # yellow background
> >>> set(gcf, "color", "none");  # transparent background
> >>>
> >> This should also be done for the axes as the axes and figures are
> >> treated separately. Shouldn't "none" be the default color for the
> >> figure and axes?
> > For axes, there already is a color value "none" and it leads to
> > transparent axes (which is particularly useful, when plotting two axes
> > on top of each other).
> >
> > Before the changes in 1e38d9ed1e28 (and related), no color was drawn for
> > axes and figure in the gnuplot backend which is equivalent to "none".
> >
> > I would also be happy with "none" as default. Only the matlab default
> > happens to be light gray for the figure background and white for axes.
> >
>
> To recap:
>  - At the moment white is the default figure background (color [1 1 1]).
>  - By the gnuplot backend this white background is drawn as an additional 
> white
> rectangle (which has a black boundary around it for some reason).
>  - The patch I proposed will allow one to remove this white rectangle by 
> setting
>        set(gcf, "color", "none")
>  - The fltk backend does not know yet how to deal with color "none". It will
> ignore it as far as I can see.
>  - Apparently, there are different opinions on the default background colors 
> for
> plots in octave
>
> Today I learned another reason why I want to be able to get rid of the
> background color: in postscript files generated with print xxx.ps, the
> additional rectangle for the figure background color will enlarge the bounding
> box to the paper size which can be quite annoying...
>
> As to the defaults: I'd say either
>  - color defaults as in matlab (white axes on gray figure background)
> or
>  - color "none" to interfere with the backend as little as possible
>
> Ben reported that matlab has different defaults for plots on screen and 
> printed
> output. As long as this is not possible in octave, I would vote for color 
> "none"
> (both figure and axes).
>
> Anyway, I would like to ask: Is it ok to push the proposed patch? I would also
> like to make color "none" equivalent to color white for the fltk backend, but 
> I
> have no idea where to look in the code (can somebody with more insight give 
> me a
> hint?).
>

This should give you a hint:

--- a/src/gl-render.cc
+++ b/src/gl-render.cc
@@ -592,6 +592,12 @@
       glClearColor (c(0), c(1), c(2), 1);
       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     }
+  else
+    {
+      // default for radio value is white
+      glClearColor (1, 1, 1, 1);
+      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    }

   // Draw children

But I wouldn't push it like this. At the very least the default for a
radio value should be the default color, not hardcoded white.

Shai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]