plotting on top of images

John W. Eaton jwe at octave.org
Tue May 26 13:21:47 CDT 2009


On 23-May-2009, Ben Abbott wrote:

| On May 22, 2009, at 4:53 PM, John W. Eaton wrote:
| 
| > On 22-May-2009, Søren Hauberg wrote:
| >
| > | Hi All
| > |
| > | With a recent checkout I can't seem to plot on top of images:
| > |
| > |         A = rand (100);
| > |         [X, Y] = find (A > 0.9);
| > |         imshow (A)
| > |         hold on, plot (X, Y, 'o'), hold off
| > |
| > | This should produce a gray scale image just containing noise, but  
| > with
| > | some red circles on top of the brightest pixels. But instead I get  
| > the
| > | following error:
| > |
| > | "
| > | multiplot> plot "-" binary array=100x100 scan=yx origin=(1,1) dx=1  
| > dy=1
| > | using 1 title "" with image; , "-" binary format='%float64'  
| > record=1040
| > | using ($1):($2) axes x1y1 title "" with points linestyle 2 ;
| > |
| > | ^
| > |            line 0: invalid command
| >
| > The following change avoids the problem for me, but I don't know
| > whether it will break something else.
| >
| > diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/ 
| > __go_draw_axes__.m
| > --- a/scripts/plot/__go_draw_axes__.m
| > +++ b/scripts/plot/__go_draw_axes__.m
| > @@ -391,7 +391,7 @@
| > 	    titlespec{data_idx} = "title \"\"";
| > 	    usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx  
| > origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s",
| > 		x_dim, y_dim, x_origin, y_origin, dx, dy, format);
| > -	    withclause{data_idx} = sprintf ("with %s;", imagetype);
| > +	    withclause{data_idx} = sprintf ("with %s", imagetype);
| >
| > 	  else
| > 	    ximg_data{++ximg_data_idx} = img_data;
| >
| >
| > jwe
| 
| I've encountered semicolons in other places that had similar effects.  
| My solution was the same as what you've proposed.

The semicolon in question seems to have been added in this changeset:

  http://hg.savannah.gnu.org/hgweb/octave/rev/3c7a36f80972

Was there a reason for adding it earlier?

jwe



More information about the Bug-octave mailing list