Search code examples
matlabplotmatlab-figure

filling between lines with plus sign


I want to fill between any curves with + sign in matlab. For simplicity, you can consider the unit square and I want to have + signs everywhere inside of the square. I have tried to use fill function in matlab, but that's make the region colorful but not filled with + sign. Any ideas?


Solution

  • Another possibility is to use the stipple function from Chad Greene's Climate Data Toolbox from Matlab file exchange. You can read the docs on the function here.

    xx=[-10:.01:10];
    yy=[-10:.01:10];
    [X,Y]=ndgrid(xx,yy);
    mask=zeros(size(X));
    mask(X>0 & Y>0)=1;
    figure
    pcolor(X,Y,mask),shading flat,colorbar
    hold on
    stipple(X,Y,logical(mask),'density',35,'color','r','marker','+','markersize',9)
    

    enter image description here