bugGNU Octave - Bugs: bug #56137, Y-axis label is cut-off in the...

 
 

bug #56137: Y-axis label is cut-off in the saved png file

Submitter:  Florence <fleuzi>
Submitted:  Mon 15 Apr 2019 07:17:23 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Confirmed Assigned to:  None
Originator Name:  fleuzi Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 10 Sep 2022 01:05:45 AM UTC, comment #2: 

Using 6.1 and pantxo's code.

The writing is cutoff for the saved image.
The plot looks good.
Did something change?





Anonymous
Mon 15 Apr 2019 07:54:13 AM UTC, comment #1: 

Confirmed. Note that this is not only visible when printing, the onscreen figure is also cropped.
This is due to the addition of a colorbar, which makes the subplots stop adapting their size depending on the labels. The workaround is to add the colorbars last:


close all
clear all

start  = datenum (2019, 4, 11, 12, 00);
time   = (start:7:start+99*7)';
y_name = {'Niveaumessung 1', 'Niveaumessung 2', 'Entleerungspumpe'};
data   = rand (100, 3);

figure (1);
colormap ('autumn');
nsp = size (data, 2);
for ii = 1:nsp
  subplot (nsp, 1, ii)
  imagesc (time, nsp-1, data(:, ii)', [0 1]);
 datetick ('x', 'mm-dd');
 set (gca, 'YTick', 2, 'YTickLabel', y_name{ii});
endfor
filename = 'example.png';

for ii = 1:nsp
  subplot (nsp, 1, ii)
  colorbar
endfor
saveas (1, filename);


Changing release to "dev", since this bug is also present in the current development version, and OS to any since I can reproduce on linux.

Pantxo Diribarne <pantxo>
Group Member
Mon 15 Apr 2019 07:17:23 AM UTC, original submission:  

I'm plotting data quality in a calendar with y-axis = time, colorbar = data quality of measurements [0 1] and y-axis label = name of the measurement. When I save the resulting figure directly as a .png file in the code, the y-axis label is cut-off (see generated file "example.png").



close all
clear all

start  = datenum (2019, 4, 11, 12, 00);
time   = (start:7:start+99*7)';
y_name = {'Niveaumessung 1', 'Niveaumessung 2', 'Entleerungspumpe'};
data   = rand (100, 3);

figure (1);
colormap ('autumn');
nsp = size (data, 2);
for ii = 1:nsp
  subplot (nsp, 1, ii)
  imagesc (time, nsp-1, data(:, ii)', [0 1]);
 colorbar
 datetick ('x', 'mm-dd');
 set (gca, 'YTick', 2, 'YTickLabel', y_name{ii});
endfor
filename = 'example.png';
saveas (1, filename);


Florence <fleuzi>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #53673:  example.png added by None (29KiB - image/png)
file #46774:  example.png added by fleuzi (26KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by fleuzi (Submitted the item)
  • -email is unavailable- added by fleuzi
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-10 None Attached File- Added example.png, #53673
    2019-04-15 pantxo Item GroupOther Inaccurate Result
        StatusNone Confirmed
        Release4.4.1 dev
        Operating SystemMicrosoft Windows Any
    2019-04-15 fleuzi Attached File- Added example.png, #46774
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code