Plot a hatched data set over a contour plot

Hi everybody,
I am trying to implement a solution that has already been dicussed in another question. I have a contour map on top of which I'd like to hatch all values of another contour higher than a certain threshold.
This is the current plot:
I have population data (with the same meshgrid as the already plotted contour). I'd like to mark regions with high population density and regions with even higher densities.
I keep getting the error "Unsupported graphics handle type." on the fourth last of those lines:
At the moment this is the code:
[~, h2]=contourf(xll, yll, concTotal, [1.5 1.5], 'linecolor', 'none'); % tbh i don't understand what the [1.5 1.5] does. Is this where I could set the thresholds?
set(h2,'linestyle','none','Tag','HatchingRegion','fill','off');
hp = findobj(h2,'Tag','HatchingRegion');
hh = hatchfill2(hp,'cross','LineWidth',1,'Fill','off');
[~, hContour]=contourf(xll, yll, concTotal, levels, 'linecolor', 'none'); % this is the already plotted contour
colormap
colorbar
I wish I'd manage to understand the problem myself, but I am pretty new to matlab.
Thanks in advance for some help.

Answers (0)

Categories

Asked:

on 10 Jun 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!