Rank: 146372 based on 0 downloads (last 30 days) and 0 file submitted
photo

twimmeh

E-mail
Company/University
UoA

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by twimmeh View all
Updated File Comments Rating
02 May 2013 Hatchfill Fills an area with hatching or speckling. Author: Neil Tandon

aaaand if you want the aspect ratio of the hatch pattern to be correct you need to pass the axes handle to the hatch_xy function and replace calls to gca.

nasty, but works:

function [xi,yi,x,y]=hatch_xy(hax,x,y,varargin);
gca = hax;

(and of course updating the relevant hatch_xy call line)

02 May 2013 Hatchfill Fills an area with hatching or speckling. Author: Neil Tandon

I _believe_ the problem with legend hatching is that the lines are being drawn on the wrong axes.

If you adjust the calls to 'line' in the function to specify the axes parent then it seems to work... at least for me (R2011b).

-----------------------------------------

H(j) = line(xhatch,yhatch,'marker','.','linest','none', ...
'markersize',specksize,'color',linec,'parent',hax);

and

H(j) = line(xhatch,yhatch,'parent',hax);

-----------------------------------------

%My legend code:

hLegend = legend(...);
hp = findobj(hLegend, 'Type', 'patch');
hatchfill(hp)

This assumes you have only one patch; you need to specify hp(i) in the hatchfill call when there are multiple patches. Also, I've found you need to increase the SPACING parameter for it to look good.

26 Sep 2012 export_fig Exports figures nicely to a number of vector & bitmap formats. Author: Oliver Woodford

Contact us