octave-maintainers
[Top][All Lists]
Advanced

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

Re: figure background color when printing


From: Ben Abbott
Subject: Re: figure background color when printing
Date: Sat, 24 Apr 2010 16:39:59 -0400

On Apr 24, 2010, at 3:23 PM, David Bateman wrote:

> Ben Abbott wrote:
>> When the figure background color was added for the gnuplot backend, David 
>> checked to ensure the color property value was numeric before setting it.
>> 
>>      http://hg.savannah.gnu.org/hgweb/octave/rev/1e38d9ed1e28
>> 
>> This is important because Matlab sets the color to "none" when printing. 
>> Unfortunately, Octave only supports numeric values or the color.
>> 
>> This change is beyond my understanding. Can someone take a look?
>> 
>> Ben
>> 
> Ben,
> 
> I no longer have access to matlab so I can't check want it does... Are you 
> saying that matlab support "none" for the figure property and that when 
> printing it is set to "none" automatically? If so the change is relatively 
> simple and we have to make the figure color property support radio values 
> like the axes color property does in graphics.cc and then in the print.m 
> function in an unwind/protect block store the figure color, set it to none 
> and reset it to the initial value in the protect block. Do you want me to do 
> this? Is the axes color property also set to none when printing?
> 
> BTW, what is the default axes color in matlab? It would make a lot of sense 
> to me if it was "none" and would allow the bug #29060 to be closed. If it 
> isn't "none" is it set to "none" for imagess so that contours can overlay 
> images.. Can you tell me what matlab gives for
> 
> close all
> reset(0)
> plot(1:10)
> drawnow()
> get(gca(), 'color')
> close all
> imagesc(hilb(4))
> drawnow()
> get(gca(),'color')
> 
> Cheers
> David

David,

I get "none" for each. 

If I try ...

set (gcf, 'color', [0 0 1])
set (gca, 'color', [0 0 1])
plot (0:10)
print -dpng test.png
print -dpdf test.pdf

In both cases I get a white figure background with an axes with a white 
background.

The fix for print.m is trivial.

--- /Users/bpabbott/Development/mercurial/octave/scripts/plot/print.m   
2010-03-27 19:36:43.000000000 -0400
+++ print.m     2010-04-24 12:19:11.000000000 -0400
@@ -586,6 +586,7 @@
     p.paperposition = get (gcf, "paperposition");
     p.paperpositionmode = get (gcf, "paperpositionmode");
     p.paperorientation = get (gcf, "paperorientation");
+    p.color = get (gcf, "color");
     if (p.papersize(1) > p.papersize(2))
       paperorientation = "landscape";
     else
@@ -637,6 +638,7 @@
     unwind_protect
       set (gcf, "paperunits", "inches");
       set (gcf, "units", "pixels");
+      set (gcf, "color", "none");
       restore_properties = true;
       if ((! output_for_printer || is_eps_file) && ! doprint)
         ## If not PDF or PostScript, and the result is not being sent to a 
printer,

SInce you're implying that I may be able to handle the change to the c++ 
sources, it must be trival ;-)

Is this all that is needed?

-      color_property color , color_values (1, 1, 1)
+      color_property color , color_property (color_values (1, 1, 1), 
radio_values ("none"))

In any event, feel free to push a changeset.

Ben






reply via email to

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