bugGNU Octave - Bugs: bug #35363, fplot key messed up

 
 

bug #35363: fplot key messed up

Submitter:  Dmitri A. Sergatskov <dasergatskov>
Submitted:  Tue 24 Jan 2012 08:43:55 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Dmitri A. Sergatskov Open/Closed:  * Closed
Release:  * 3.6.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 23 Dec 2014 11:46:22 PM UTC, comment #3: 

I fixed this in this changest (http://hg.savannah.gnu.org/hgweb/octave/rev/e23aedcc70a7).

for loops are very slow in any interpreted language so I changed the patch to use regexprep.  This has the added benefit of working on cell array of strings which is possible if users have multi-line text blocks.

Closing report.

Rik <rik5>
Group administrator
Tue 23 Dec 2014 10:30:39 PM UTC, comment #2: 

HI,

Here is a small patch the add \ before @.

 if (enhanced)
    n1 = 1;
    for  n = 1:numel(str)
      if (str(n) == '@')
        str1(n1) = '\';
        n1 ++;
      endif
      str1(n1) = str(n);
      n1 ++;
    endfor
    str = str1;
  endif


attached _go_draw_axes_.patch & _go_draw_axes_.m

Please review.

Avinoam

(file #32705, file #32706)

Avinoam Kalma <avinoam>
Group Member
Sat 28 Jan 2012 05:42:53 PM UTC, comment #1: 

This bug is confirmed.  It is a problem with all text output to gnuplot.  For example, the following also shows the issue.


close all;
graphics_toolkit gnuplot;
text (0,0, "@(t) sin (t));


The issue is gnuplot's extended interpretation of text strings.  Most of the time this is good because '^' is very naturally interpreted as a superscript and '_' is interpreted as a subscript.  The issues is that '@' is a special character indicating that a zero-width box should surround the next bit of text.

As an immediate workaround, you can escape the special character with a '\'.  The following will work.


fun = @(t) sin(t);
fplot(fun, [-5,5])
legend ('\@(t) sin(t)');


The longer term fix is to get Octave's backend to do the same work of escaping special characters in user strings.  I'm adding Ben Abbott to the CC list for this bug since he specializes in this part of Octave.

Rik <rik5>
Group administrator
Tue 24 Jan 2012 08:43:55 PM UTC, original submission:  

With gnuplot (3.4.4) backend on octave 3.6.0 fplot
messes up the key label if the function defined through "@"
mechanism:

E.g.:

fun = @(t) sin(t);
fplot(fun, [-5,5])

That works fine with fltk backend.

Note that Matlab does not put key at all -- but
perhaps this is a separate issue.

Dmitri.
--
 

Dmitri A. Sergatskov <dasergatskov>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #32705:  __go_draw_axes__.m added by avinoam (89KiB - application/octet-stream)
file #32706:  __go_draw_axes__.patch added by avinoam (602B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by dasergatskov (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-23 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-12-23 avinoam Attached File- Added _go_draw_axes_.m, #32705
        Attached File- Added _go_draw_axes_.patch, #32706
    2012-01-28 rik5 StatusNone Confirmed
        Carbon-Copy- Added bpabbott
    2012-01-24 jordigh Releasedev 3.6.0

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code