2
votes

I am trying out octave as an alternative to matlab and it looks like the graph plot in octave is not as interactive as matlab

I want to find out the value of the x and y coordinates of a data point on the plot by clicking on it

I have seen the ginput function, but while my figure is open, if I call the function, click on a point in the figure and then press the Enter key, I get the following result:

[x, y, buttons] = ginput ()  
x = [](0x0)
y = [](0x0)
buttons = [](0x0)  

While messing around I did manage to get proper coordinate values once

figure(1); [x, y, buttons] = ginput ()
x =  69.09677419354838
y =  127.2917862029395
buttons = 13  

but I am not sure what I did different, and I haven;t been able to make it happen again

How can I click on a data point in in Octave figure and find it's value (both x and y, or at least just y)? Is it possible to select an exact data point on a plot using the ginput or any other function in Octave?

1
Please mention which version of octave you're using and if it's GUI or console. The default GUI interface shows the coordinates prominently on the bottom left of the figure as you hover with your mouse. - Tasos Papastylianou
I've just tested "ginput" as well, and it appears that a bug has been introduced. I would encourage you to submit a bug (if one is not already present). In the meantime, you can use get(gca, 'currentpoint') to do what you want as a workaround. - Tasos Papastylianou
@Tasos It is octave-4.4.1-w32 and I am using GUI. Is it possible to get a more interactive graph plot (similar to matlab, with at least the feature to click and view data points) in octave? - user13267
It appears that keyboard events are registered properly, whereas mouse events are ignored. The time you got a reply was probably when you pressed a key (not sure what key 13 is though) - Tasos Papastylianou
@Tasos and it is actually the zip file version not a full install - user13267

1 Answers

1
votes

The behaviour described above seems to be a bug with the QT interface. The fltk interface works as expected. Try:

graphics_toolkit fltk

to enable it.

I will file a bug in the meantime. bug submitted

PS. Keyboard events seem to be detected normally, but mouse events are not, hence the empty lists. The '13' accidental output must have been from pressing 'small enter' and registering a newline keyboard event, before pressing 'big enter' thus forcing ginput to return.

UPDATE it appears that switching back to the qt interface and trying again now allows mouse events to work. This has persisted following an octave restart. Weird bug.