Plot a hatched data set over a contour plot
4 views (last 30 days)
Show older comments
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/313493/image.png)
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.
0 Comments
Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!