bugGNU Octave - Bugs: bug #48200, axes labels are not visible...

 
 

bug #48200: axes labels are not visible printing a figure with gnuplot and epslatex (gnuplot)

Submitter:  Torsten Lilge <ttl>
Submitted:  Sat 11 Jun 2016 07:59:20 AM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Torsten Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 21 Jun 2016 06:18:22 AM UTC, comment #8: 

Oh, yes, well there is no background rectangle in that case.  If you would like to see exactly what Octave is sending to gnuplot, try the following:


t = 0:0.01:12;
plot (t, sin (t));
legend ('$\sin(t)$');
drawnow ('epslatex', 'sinewave.tex', 'foo.gp');


and examine the resulting 'foo.gp' file in the system directory.  These two lines


set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb "#ffffff" fs solid noborder
set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb "#ffffff" fs solid noborder


are what's covering the text.  You can comment out these lines and use "load 'foo.gp'" inside gnuplot.

Dan Sebald <sebald>
Tue 21 Jun 2016 05:58:56 AM UTC, comment #7: 

With "directly" I mean plotting a data-set via the gnuplot command line (or a gnuplot script) after having set the terminal to epslatex.

Torsten Lilge <ttl>
Group Member
Tue 21 Jun 2016 04:57:57 AM UTC, comment #6: 

As for "none" being the default, I don't know.  The Octave code is doing something slightly odd in that it is changing the color to white temporarily when printing.  It might be that way so bitmapped output formats that have a transparent background option (PNG? GIF?) end up by default with a white background.

Dan Sebald <sebald>
Tue 21 Jun 2016 04:54:07 AM UTC, comment #5: 

I think it is a bug in gnuplot's epslatex terminal.  What did you mean by "directly using gnuplot"?  Using some other gnuplot terminal such as Qt?  Or the epslatex terminal?

Dan Sebald <sebald>
Tue 21 Jun 2016 04:27:53 AM UTC, comment #4: 

Dan, thanks for going into this. I will try the code sequence from comment #3.

Regarding comment #2, is this really a gnuplot bug? Directly using gnuplot works, i.e. the axes text is visible. Should the color be set to "none" by default?

Torsten Lilge <ttl>
Group Member
Mon 20 Jun 2016 07:27:15 PM UTC, comment #3: 

Oh, you should be able to use the following to make the axis text visible:


t = 0:0.01:12;
plot (t, sin (t));
legend ('$\sin(t)$');
set(gcf, 'color', 'none')
set(gca, 'color', 'none')
print ('plot.eps','-depslatexstandalone','-S400,240');


Dan Sebald <sebald>
Mon 20 Jun 2016 07:19:19 PM UTC, comment #2: 

This seems like a gnuplot bug, doesn't it?  There's no way to really control what gnuplot is placing into the latex file.  I'll create a gnuplot bug ticket for this.

I did uncover a couple Octave bugs though.  Trying to disable all backgrounds, I did the following:


>> t = 0:0.01:12;
>> plot (t, sin (t));
>> set(gcf, 'color', 'none')
>> set(gca, 'color', 'none')
>> print ('plot.eps','-depslatexstandalone','-S400,240');
error: 'n' undefined near line 408 column 15
error: called from
    print at line 408 column 12


What's happening is that n is undefined because there are no large scale objects having a white background, numel(hax) equals 0:


      ## Set background to white for all top-level axes objects
      hax = findall (opts.figure, "-depth", 1, "type", "axes",
                                  "-not", "tag", "legend",
                                  "-not", "color", "none");
      m = numel (props);
      for n = 1:numel(hax)
        props(m+n).h = hax(n);
        props(m+n).name = "color";
        props(m+n).value{1} = get(hax(n), "color");
        set (hax(n), "color", "white");
      endfor
      nfig += n;


Also, to accommodate a solution here without requiring a gnuplot upgrade, it seems logical that if the figure color is "none" there should be no background.  So I made a change there as well.

See attached changeset.

(file #37532)

Dan Sebald <sebald>
Mon 20 Jun 2016 06:08:24 PM UTC, comment #1: 

I know that a large rectangle was added some time ago to create a (in this case) white background so the color of the background could be changed according to the plot properties.

The way this appears to work is define gplbacktext and gplfrontttext as empty near the beginning.  Then add to that text along the way.  Then do the following:


    \gplbacktext
    \put(0,0){\includegraphics{plot-inc}}%
    \gplfronttext


So, yes, if the plot-inc (I ran this with -depslatexstandalone) has a completely opaque visual field (i.e., white rectangle at bottom) then it will completely cover the gplbacktext.

A solution that sort of works is to put the text all in gplfronttext, i.e., change from


\begin{picture}(8000.00,4800.00)%
    \gplgaddtomacro\gplbacktext{%


to


\begin{picture}(8000.00,4800.00)%
    \gplgaddtomacro\gplfronttext{%


This isn't quite what we want though, is it?  We want something like


    \put(0,0){\includegraphics{plot-background}}%
    \gplbacktext
    \put(0,0){\includegraphics{plot-graphics}}%
    \gplfronttext


Dan Sebald <sebald>
Sat 11 Jun 2016 07:59:20 AM UTC, original submission:  

When printing a figure with the gnuplot backend and the epslatex driver, the text in the legend is visible but not the axes labels. In the produced tex-file, the latter is processed in the macro \gplbacktext, which is displayed before the graphics. It seems to me that the graphics part from the eps-file now also has some opacity outside the diagram's box hiding the contents of \gplbacktext.

I have attached the Octave script and the tex-file for reproducing the issue.

Torsten Lilge <ttl>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37452:  main.tex added by ttl (101B - application/x-tex)
file #37451:  plotit.m added by ttl (100B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by ttl (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-22 rik5 Summaryaxes labels are not visible printing a figure with gnuplot and epslatex axes labels are not visible printing a figure with gnuplot and epslatex (gnuplot)
    2016-06-20 sebald Attached File- Added octave-print_figure_axis_background_bug48200-djs2016jun20.patch, #37532
    2016-06-11 ttl Attached File- Added main.tex, #37452
    2016-06-11 ttl Attached File- Added plotit.m, #37451

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code