bugGNU Octave - Bugs: bug #53888, figure handle is not cleared in...

 
 

bug #53888: figure handle is not cleared in gnuplot

Submitter:  Lars Kindermann <larskindermann>
Submitted:  Sun 13 May 2018 10:43:27 AM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  * Closed
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

Mon 14 May 2018 09:57:42 PM UTC, comment #8: 

I think this bug can be closed as a duplicate of bug #46654, which was closed with status Won't Fix.

The gnuplot interface is one way, and any mouse interactions that are made on the gnuplot figure window are not known to Octave at all, and this is not likely to change.

Mike Miller <mtmiller>
Group Member
Mon 14 May 2018 10:59:25 AM UTC, comment #7: 

Actually, for plotting serial time data it would be sufficient to subtract an offset to center the data around zero. The problem arises from the fact that serial date's zero is 2000 years in the past. So two consecutive seconds now just differ in the 36th bit:


>> log2(now/(now-1/24/60/60)-1)
ans = -35.894


I was already looking into the plot and datetick code but found no easy way to introduce scaling / offsetting before sending data to qt. Everything must be done transparent in both directions for interactive zooming etc. It would be a massive rewrite of the plot code as scale factors and offsets have to appear in many places.

I work a lot with geoscience data where timestamps have millicecond precision and span decades. Porting even small scripts from matlab to octave can become a real hazzle when using qt.


Lars Kindermann <larskindermann>
Mon 14 May 2018 10:57:28 AM UTC, comment #6: 

Lars: You are right. Some additional work, but displaying
appropriate axis labels often requires manual work.
Anyhow, the right answer is the implement bug #32980 in
the qt code.

Michael Godfrey <godfrey>
Group Member
Mon 14 May 2018 09:57:42 AM UTC, comment #5: 

When you scale serial times for plotting, the datetick() function won't work anymore. So in addition to scaling you have to rewrite  the complete axis annotation code as well.

Lars Kindermann <larskindermann>
Mon 14 May 2018 09:52:37 AM UTC, comment #4: 

Lars said: As long as bug #32980 is open (the other toolkits use single precision for plotting only), gnuplot is the only viable option for many cases, e.g. if you plot any timeseries where the time is represented as a serial date and the resolution is in the order of one minute or less.


Keep in mind that this is only a scaling issue. The graphics rendering is 32bit.
So, the user can do the scaling and get plots which are accurate to the available
hardware. bug #32980 is just a request to provide the scaling automatically rather
than have the user do it. And, qt is currently the preferred toolkit.

Michael Godfrey <godfrey>
Group Member
Mon 14 May 2018 09:19:55 AM UTC, comment #3: 

The gnuplot code is mainly in the form of script files, not source code.  The portion in source code is simple the mechanism that creates a pipe, forks a process to run gnuplot and connects the pipe to that process.  The script files are in


scripts/plot/util
scripts/plot/util/private


The main files are


__gnuplot_draw_axes__.m
__gnuplot_draw_figure__.m


The one routine that sort of gathers info about gnuplot is


__gnuplot_version__.m


but that is done using a system command


    [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ()));


not by interacting with the existing gnuplot process via the pipe.

Again, gnuplot doesn't provide any information about what "figures" are open because everything is a basic terminal.  The sorts of info that gnuplot provides is


gnuplot> show var all

        All available variables:
        pi = 3.14159265358979
        GNUTERM = "qt"
        NaN = NaN
        GPVAL_TERM = "qt"
        GPVAL_TERMOPTIONS = "0 font \"Sans,9\""
        GPVAL_OUTPUT = ""
        GPVAL_ENCODING = "default"
        GPVAL_MINUS_SIGN = "-"
        GPVAL_MICRO = "u"
        GPVAL_DEGREE_SIGN = "\302\260"
        GPVAL_VERSION = 5.3
        GPVAL_PATCHLEVEL = "0"
        GPVAL_COMPILE_OPTIONS = "    -READLINE  +LIBREADLINE  +HISTORY  \n    -BACKWARDS_COMPATIBILITY  +OBJECTS  +STATS +EXTERNAL_FUNCTIONS \n    +LIBCERF  +GD_PNG  +GD_JPEG  +GD_TTF  +GD_GIF  +ANIMATION  \n    -USE_CWDRC  +X11  +X11_EXTERNAL +USE_MOUSE  +HIDDEN3D_QUADTREE  \n"
        GPVAL_MULTIPLOT = 0
        GPVAL_PLOT = 1
        GPVAL_SPLOT = 0
        GPVAL_TERMINALS = " cairolatex canvas cgm context domterm dumb dxf eepic emf emtex epscairo epslatex fig gif hpgl jpeg latex lua mf mp pcl5 pdfcairo png pngcairo postscript pslatex pstex pstricks qms qt sixelgd svg tek40xx tek410x texdraw tgif tikz tkcanvas tpic unknown vttek wxt x11 xlib xterm "
        GPVAL_pi = 3.14159265358979
        GPVAL_NaN = NaN
        GPVAL_SYSNAME = "Linux"
        GPVAL_MACHINE = "x86_64"
        GPVAL_BITS = 64
        GPVAL_ERRNO = 1
        GPVAL_ERRMSG = "invalid command"
        GPVAL_SYSTEM_ERRNO = 0
        GPVAL_SYSTEM_ERRMSG = ""
        GPVAL_PWD = "/home/sebald/apartments/lake_forest/comed/bills/2015"
        GPVAL_LINENO = 0
        ARGC = 0
        ARG0 = ""
        GPVAL_LAST_PLOT = "plot x"
        GPVAL_X_MIN = -10.0
        GPVAL_X_MAX = 10.0
        GPVAL_X_LOG = 10.0
        GPVAL_DATA_X_MIN = 8.98846567431158e+307
        GPVAL_DATA_X_MAX = -8.98846567431158e+307
        GPVAL_Y_MIN = -10.0
        GPVAL_Y_MAX = 10.0
        GPVAL_Y_LOG = 10.0
        GPVAL_DATA_Y_MIN = -10.0
        GPVAL_DATA_Y_MAX = 10.0
        GPVAL_X2_MIN = -10.0
        GPVAL_X2_MAX = 10.0
        GPVAL_X2_LOG = 10.0
        GPVAL_DATA_X2_MIN = 8.98846567431158e+307
        GPVAL_DATA_X2_MAX = -8.98846567431158e+307
        GPVAL_Y2_MIN = -10.0
        GPVAL_Y2_MAX = 10.0
        GPVAL_Y2_LOG = 10.0
        GPVAL_DATA_Y2_MIN = 8.98846567431158e+307
        GPVAL_DATA_Y2_MAX = -8.98846567431158e+307
        GPVAL_Z_MIN = -10.0
        GPVAL_Z_MAX = 10.0
        GPVAL_Z_LOG = 10.0
        GPVAL_DATA_Z_MIN = 0.0
        GPVAL_DATA_Z_MAX = 0.0
        GPVAL_CB_MIN = 8.98846567431158e+307
        GPVAL_CB_MAX = -8.98846567431158e+307
        GPVAL_CB_LOG = 10.0
        GPVAL_DATA_CB_MIN = 8.98846567431158e+307
        GPVAL_DATA_CB_MAX = -8.98846567431158e+307
        GPVAL_T_MIN = -5.0
        GPVAL_T_MAX = 5.0
        GPVAL_T_LOG = 10.0
        GPVAL_U_MIN = -5.0
        GPVAL_U_MAX = 5.0
        GPVAL_U_LOG = 10.0
        GPVAL_V_MIN = -5.0
        GPVAL_V_MAX = 5.0
        GPVAL_V_LOG = 10.0
        GPVAL_R_MIN = 8.98846567431158e+307
        GPVAL_R_MAX = -8.98846567431158e+307
        GPVAL_R_LOG = 10.0
        GPVAL_TERM_XMIN = 385
        GPVAL_TERM_XMAX = 6189
        GPVAL_TERM_YMIN = 280
        GPVAL_TERM_YMAX = 4659
        GPVAL_TERM_XSIZE = 6400
        GPVAL_TERM_YSIZE = 4800
        GPVAL_TERM_SCALE = 1
        GPVAL_VIEW_MAP = 0
        GPVAL_VIEW_ROT_X = 60.0
        GPVAL_VIEW_ROT_Z = 30.0
        GPVAL_VIEW_SCALE = 1.0
        GPVAL_VIEW_ZSCALE = 1.0
        GPVAL_VIEW_AZIMUTH = 0.0
        GPVAL_VIEW_XCENT = 1.0
        GPVAL_VIEW_YCENT = 0.0
        GPVAL_VIEW_RADIUS = 0.0


Nothing in that list indicates what terminals are visible, and still that would mean polling that information rather than gnuplot sending information through the pipe to Octave core.

There is one way that such information can be had, if one knows gnuplot well enough.  Some terminals like Qt and x11 will allow passing information to gnuplot's "term" command that identifies an existing window that can serve as gnuplot's canvas.  That is, rather than creating a new window, gnuplot would render in an existing window.  So, Octave would have to create it's own Qt window, then select gnuplot's Qt terminal and pass the window ID to gnuplot.  All that work isn't worth it, as I see it.  If it were a very limited application with specific selection of gnuplot's Qt terminal, then sure.  But not in a more general app where user's are selecting the terminal type.

Dan Sebald <sebald>
Mon 14 May 2018 08:55:05 AM UTC, comment #2: 

As long as bug #32980 is open (the other toolkits use single precision for plotting only), gnuplot is the only viable option for many cases, e.g. if you plot any timeseries where the time is represented as a serial date and the resolution is in the order of one minute or less.

I wouldn't expect any interactive gnuplot features, octave just needs to know when the figure window gets closed to clear the figure handle proper. Otherwise, very simple scripts (show a plot, wait until the user closes it and continue or exit cleanly) won't work when changing from other toolkits to gnuplot.

Maybe somebody can give me a hint where to look in the sources to look after this.

Lars Kindermann <larskindermann>
Sun 13 May 2018 07:25:01 PM UTC, comment #1: 

gnuplot toolkit has deficiencies in that regard.  It's an externally program, so there is no easy way of knowing what the user is doing.  For example, do the following:


>> close all
>> graphics_toolkit gnuplot
>> sombrero
>> [azimuth, elevation] = view ()
azimuth = -37.500
elevation =  30
>> # manually rotate the plot
>> [azimuth, elevation] = view ()
azimuth = -37.500
elevation =  30


Note how the angle does not change because the info can't be gotten from gnuplot, at least not in an easy way.  gnuplot has a terminal model, meaning that all of its drivers are like data sinks.  The program can switch freely between terminals, Qt, x11,  latex, etc. but none of them are interactive (the mousing is a bit of trick in most of the on-screen terminals).

I doubt anyone will attempt to fix this.  gnuplot toolkit is mainly an alternative that offers more flexible print display types, i.e., output formats.  It shouldn't be used for GUIs.

Dan Sebald <sebald>
Sun 13 May 2018 10:43:27 AM UTC, original submission:  

After closing a gnuplot figure window, the figure handle still exists.


graphics_toolkit gnuplot
figure(1)

#close the figure window

get(1)


This causes things like uiwait() to never return:


graphics_toolkit gnuplot
figure(1)
disp "please close the figure"
uiwait(1)
disp "Ok"



Lars Kindermann <larskindermann>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by larskindermann (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
    2018-05-14 mtmiller Dependencies- Depends on bugs #46654
    2018-05-14 mtmiller Item GroupRegression Incorrect Result
        StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code