octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58395] Printing an empty figure


From: Guillaume
Subject: [Octave-bug-tracker] [bug #58395] Printing an empty figure
Date: Mon, 18 May 2020 12:23:55 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

URL:
  <https://savannah.gnu.org/bugs/?58395>

                 Summary: Printing an empty figure
                 Project: GNU Octave
            Submitted by: gyom
            Submitted on: Mon 18 May 2020 04:23:53 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Guillaume
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Printing an empty figure in a raster format does not return the expected error
message:


octave:1> figure
octave:2> print test.png
error: matrix cannot be indexed with {
error: called from
    __print_parse_opts__ at line 251 column 14
    print at line 417 column 8
octave:3> print test.pdf
error: print: no axes object in figure to print
error: called from
    print at line 449 column 5


Variable "ht" has to be checked before being used:


--- a/scripts/plot/util/private/__print_parse_opts__.m  Mon May 18 18:10:39
2020 +0900
+++ b/scripts/plot/util/private/__print_parse_opts__.m  Mon May 18 17:20:09
2020 +0100
@@ -248,7 +248,11 @@
     if (opengl_ok && strcmp (graphics_toolkit (arg_st.figure), "qt"))
       ## "opengl" renderer only does text rotations of 0°, 90°, 180°,
270°, ...
       ht = findall (arg_st.figure, "type", "text");
-      angles = [get(ht, "rotation"){:}];
+      if (isempty (ht))
+        angles = [];
+      else
+        angles = [get(ht, "rotation"){:}];
+      endif
       if (any (mod (angles, 90)))
         arg_st.renderer = "painters";
       else


Also, Matlab allows to print an empty figure - it seems to be working in
Octave too so the error thrown when not finding an axes could be removed from
print.m




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58395>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]