bugGNU Octave - Bugs: bug #62241, Printing a plot to file triggers...


bug #62241: Printing a plot to file triggers autoscaling of the axes for small vertical scaling values

Submitter:  Serni Ribo <serni>
Submitted:  Thu 31 Mar 2022 03:01:12 PM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 5.2.0 Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Fri 01 Apr 2022 07:33:34 PM UTC, comment #2: 

As was pointed out in comment #1, very small values are always going to be a problem with plotting systems.  In particular, Octave uses OpenGL for rendering plots (unless you are using the gnuplot toolkit) and OpenGL uses single precision for all values such as coordinates.

The solution, also pointed out in comment #1, is simply to scale your data.  For example,

xs = x * 1e12;
plot (xs, y);
xlabel ("X (in picomoters)");

You could also set the ticklabels manually.

plot (1:4, 1:4, 'o-');
set (gca, "xtick", 1:4);
set (gca, "xticklabels", {"1e-10", "2e-10", "3e-10", "4e-10"})

On newer versions of Octave the interpreter for the ticklabels is "tex" so you can even have superscripts and subscripts.  The example above could be

set (gca, "xticklabels", {"1^{-10}", "2^{-10}", "3^{-10}", "4^{-10}"})

which shows rather nicely as

(file plot_exp_labels.png)

Rik <rik5>
Project Administrator
Thu 31 Mar 2022 11:45:32 PM UTC, comment #1: 

Can you change the x axis units to nanometers or picoseconds or something so you get better numerical values? Using 1e-10 as Axios tick intervals is asking for avoidable trouble with any plotting system, not just Octave.

Thu 31 Mar 2022 03:01:12 PM UTC, original submission:  

A plot with three different subplots has been created, and the axes of each subplot have been scaled using the axis() function. The axis scaling values are very small:
axis([-1e-10 4e-10 0 15000]).

When printing the figure to a file using:

print -dpng filename.png

results in autoscaling all three plots prior to converting the plot to png.

When using larger values in the axis function, such as:
axis([-1 4 0 15000), printing the plot to a files does not autoscale the plot and maintains the axis. In this case the plot is printed with the correct axes.

Serni Ribo <serni>


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

Attach Files:

Attached Files
file #53031:  plot_exp_labels.png added by rik5 (19KiB - 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 rik5 (Updated the item)
  • -email is unavailable- added by serni (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 project members can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-01 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed
    2022-04-01 rik5 Attached File- Added plot_exp_labels.png, #53031

    Back to the top

    Powered by Savane 3.9