bugGNU Octave - Bugs: bug #64245, LineWidth is limited when printing...


bug #64245: LineWidth is limited when printing in to raster image

Submitter:  Valdas <zmogas>
Submitted:  Tue 23 May 2023 08:19:06 PM UTC
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 23 May 2023 09:56:12 PM UTC, comment #1: 

The default rendering engine ("opengl") for raster formats like png has the same limitations as your opengl implementation, which limits the with of GL_LINE primitives (hence the same result onscreen).

To circumvent this issue you can switch to the vector based renderer "painters" (the former default, in versions prior to 5.2 or so), e.g.:

print ('p_test.png', '-painters', '-dpng', '-r300');

Pantxo Diribarne <pantxo>
Group Member
Tue 23 May 2023 08:19:06 PM UTC, original submission:  

This test function produces a plot with lines with various widths, and then figure is printed to PNG and SVG files:

function p_test

        close all

        plot([0, 1], [0, 1], 'linewidth', 0.5, ...
                 [1, 2], [0, 1], 'linewidth', 1, ...
                 [2, 3], [0, 1], 'linewidth', 2, ...
                 [3, 4], [0, 1], 'linewidth', 5, ...
                 [4, 5], [0, 1], 'linewidth', 10, ...
                 [5, 6], [0, 1], 'linewidth', 20);

        print ('p_test.png', ...
                   '-dpng', ...

        print ('p_test.svg', ...
                   '-dsvg', ...


The line widths in the SVG image is correct (also see rendering in the Screenshot image), but in the PNG image the line widths is limited to a certain value.

Line widths in a figure window also seems limited (see the screenshot of a figure window).

If I remember correctly, in earlier versions lines were rendered in a raster image with not width restrictions.

The Graphic toolkit is set to Qt.

Valdas <zmogas>


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

Attach Files:

Attached Files
file #54777:  p_test.png added by zmogas (85KiB - image/png)
file #54779:  p_test.svg added by zmogas (9KiB - image/svg+xml)


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 zmogas (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-05-23 pantxo StatusNone Confirmed
    2023-05-23 pantxo CategoryPlotting Plotting with OpenGL
    2023-05-23 zmogas Attached File- Added p_test.png, #54777
        Attached File- Added Screenshot_of_svg_render.png, #54778
        Attached File- Added p_test.svg, #54779
        Attached File- Added Screenshot_of_figure_window.png, #54780

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code