patchGNU Octave - Patches: patch #9280, Data cursor for Octave 4.0.x and...

 
 

patch #9280: Data cursor for Octave 4.0.x and 4.2.x

Submitted by:  Roland Baudin <roland65>
Submitted on:  Mon 06 Mar 2017 08:56:05 AM UTC  
 
Category:  Core : new feature Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 12 May 2017 02:46:42 PM UTC, comment #3:

Here is another update that fixes a bug when using the data cursor and several figures.

To install the new version, download the datacursor-v3.zip archive and copy it to your <prefix>/share/octave/<version> directory (<prefix> is /usr for Linux, c:\octave for Windows and <version> is Octave version number) and unzip it.

(file #40676)

Roland Baudin <roland65>
Fri 05 May 2017 01:44:02 PM UTC, comment #2:

I've updated the data cursor menu and function:
- the issue with the right click mouse button is fixed
- the Data menu now also appears in stem and stairs plots

To install the new version, download the datacursor-v2.zip archive and copy it to your <prefix>/share/octave/<version> directory (<prefix> is /usr for Linux, c:\octave for Windows and <version> is Octave version number) and unzip it.

(file #40594)

Roland Baudin <roland65>
Mon 06 Mar 2017 09:16:50 PM UTC, comment #1:

just adding to discussion on Octave implementation, there are a couple Matlab functions relating to this feature that are currently unimplemented in Octave:

datacursormode
- toggles the data cursor functionality in the current figure from the command line
- optional output argument creates a 'data cursor mode object' that can be accessed to set data tip properties
https://www.mathworks.com/help/matlab/ref/datacursormode.html

There appears to be a context menu option to Export data to Workspace. it prompts you for a name and then creates an struct containing graphics handle and point position. Far as I can tell there's no CLI function to produce the same behavior.

Nicholas Jankowski <nrjank>
Mon 06 Mar 2017 08:56:05 AM UTC, original submission:

Thanks to the work of Pantxo Diribarne (look here), I was able to hack Octave to get a data cursor in 2D plots.

Here is how to do in Octave 4.0.x or 4.2.x:

In the attached zip file, you'll find three .m files. Copy these three files to <prefix>/share/octave/<version>/m/plot/draw/private , where <prefix> is /usr for Linux, c:\octave for Windows, etc. and <version> is Octave version number.

2. Launch Octave gui and plot some curve, like this:

x=[0:0.01:2*pi]; y=sin(x); plot(x,y);

Then you'll see the sinus curve in a figure window. In the figure menu, at the rightmost position, you'll see a new 'Data' menu item, where you can add a new data cursor, show/hide data cursors or get cursor data. See the attached screenshot as an example.

You can have several data cursors at the same time, with different colors, fonts, etc. Just right click on a data cursor to change its properties.

This works with nearly all 2D plots (semilogx, semilogy, loglog, subplot) but doesn't work with 3D plots (the Data menu is not displayed in this case).

There are some minor issues, but it works quite well...

Note that, when you do a right mouse click, position the mouse on the arrow head and not on the text, otherwise the data cursor will move to the mouse position.

Roland Baudin <roland65>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #40676:  datacursor-v3.zip added by roland65 (13KiB - application/zip)
file #40594:  datacursor-v2.zip added by roland65 (13KiB - application/zip - Updated version)
file #39902:  datacursor.zip added by roland65 (6KiB - application/zip)
file #39903:  figure.png added by roland65 (49KiB - 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 nrjank (Posted a comment)
  • -email is unavailable- added by roland65 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-12 roland65 Attached File- => Added datacursor-v3.zip, #40676
    2017-05-05 roland65 Attached File- => Added datacursor-v2.zip, #40594
    2017-03-06 roland65 Attached File- => Added datacursor.zip, #39902
        Attached File- => Added figure.png, #39903

    Back to the top


    Powered by Savane 3.3