bugGNU Octave - Bugs: bug #36690, Hold function alters eps background

 
 

bug #36690: Hold function alters eps background

Submitter:  None
Submitted:  Wed 20 Jun 2012 05:10:51 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Wayne Menzie Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 21 Jun 2012 10:27:37 PM UTC, comment #9: 
Ben Abbott <bpabbott>
Group Member
Thu 21 Jun 2012 08:10:34 PM UTC, comment #8: 

For transparency, you can set the axes "color" to "none"

set (gca (), "color", "none")

If you prefer transparency all the time, you can get that by changing the default.

set (0, "defaultaxescolor", "none")

If you place that line in your ~/.octaverc file, the background of your plots will remain transparent the next time you run octave as well.

Ben Abbott <bpabbott>
Group Member
Thu 21 Jun 2012 08:05:21 PM UTC, comment #7: 

Ben,

Forgive my lack of understanding but would your latest patch force the background to be white instead of leaving it transparent? If so, that's not what I intended.

-Deleted Account- <beansbaxter>
Thu 21 Jun 2012 06:43:13 PM UTC, comment #6: 

Ben,

That should work, and is at least consistent since we will be setting the same default in both places.

Rik <rik5>
Group administrator
Thu 21 Jun 2012 05:45:14 PM UTC, comment #5: 

RIk,

Thanks for the comments. I gave up trying to follow how Octave handes defaults. I'm leaning toward a slightly different patch.


diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -4284,7 +4284,7 @@
   xticklabelmode = "auto";
   yticklabelmode = "auto";
   zticklabelmode = "auto";
-  color = "none";
+  color = color_values ("white");
   xcolor = color_values ("black");
   ycolor = color_values ("black");
   zcolor = color_values ("black");


I ran some tests, and all seems to work the same as ML.

Ben Abbott <bpabbott>
Group Member
Thu 21 Jun 2012 05:39:56 PM UTC, comment #4: 

The whole application of default properties to graphics objects is somewhat screwed up.  Long term, I think it will have to be re-coded.  In the short term, I think your patch is probably okay.  In C++, objects like axes can be instantiated with default properties.  The default properties for axes are in graphics-props.cc where the default is white ([1 1 1]).  Why we have a separate routine, _go_axes_init_, which is only called from newplot.m I don't know. 

The worst part is the defaults don't seem to agree.  There is the obvious mismatch for 'color', but if you look at axes::properties::factory_defaults (void) in graphics-props.cc it has defaults for things which are not initialized by _go_axes_init_ such as 'xminortick'.  Maybe this is correct, I don't know.

But your patch is probably safe for this particular issue.

Rik <rik5>
Group administrator
Thu 21 Jun 2012 12:45:12 AM UTC, comment #3: 

Ok thanks for the tip.

The code below indicates that the built-in _go_axes_init_() is setting the "color" property (background axes color) to "none".


close all
axes ()
orig_color = get (gca (), "color")
fig_default = get (gcf (), "defaultaxescolor")
root_default = get (0, "defaultaxescolor")
__go_axes_init__ (gca (), "replace")
final_color = get (gca (), "color")


I've attached a trivial patch. I'm not sure this is the proper fix, so I'll give myself time to study the code before committing it.


(file #26074)

Ben Abbott <bpabbott>
Group Member
Thu 21 Jun 2012 12:05:28 AM UTC, comment #2: 

By platform, personally confirmed to work:

Mac OS X
*The file icons clearly show the transparent vs white backgrounds
*In Preview, select View>Document Background

Windows
*Drag into PowerPoint set the slide design to a dark background or place over text
*Open in Inkscape and add a layer below the default layer then draw something on that bottom layer

Both
*Open in Photoshop (interestingly, gnuplot-generated EPS files fail to open in Photoshop)

There may be other ways (Gimp, OpenOffice Draw, OpenOffice Impress) but I haven't tried them so I cannot confirm that they would work.

-Deleted Account- <beansbaxter>
Wed 20 Jun 2012 10:37:07 PM UTC, comment #1: 

I see the same result in each case.

What did you do to determine the back ground was different for the two plots ?

Ben Abbott <bpabbott>
Group Member
Wed 20 Jun 2012 05:10:51 AM UTC, original submission:  

When using the hold function, the background of a plot is altered. The following test case illustrates this.


clf;
x = -10:0.1:10;
plot (x, sin (x));
print -color without_hold.eps;
clf;
hold on;
plot (x, sin (x));
print -color with_hold.eps;


The file "without_hold.eps" will have a transparent background and "with_hold.eps" will have a white background.

I have tested this on two systems, both with Octave 3.6.2:

Mac OS X 10.7.4 using fltk and gnuplot (x11 and aqua)
Windows XP SP3 using fltk and gnuplot

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #26074:  changeset.patch added by bpabbott (712B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by beansbaxter (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-29 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2012-06-21 bpabbott StatusPatch Submitted Ready For Test
    2012-06-21 bpabbott Attached File- Added changeset.patch, #26074
        StatusWorks For Me Patch Submitted
        Assigned toNone bpabbott
        Release3.6.2 dev
        Operating SystemMac OS Any
    2012-06-20 bpabbott StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code