Having error when ploting bars with filled pattern
2 views (last 30 days)
Show older comments
Hello,
I want to plot bar charts that have filled with different patterns and colors. Here is my code:
data_forest=xlsread('for.xlsx');
colors={'r','y','w','g'};
figure();
for ii=0:3
bar(ii*6+(1:6),data_forest(ii*6+(1:6)),'FaceColor',colors{ii+1})
hold on
end
hold off
legend('Summer','Fall','Winter','Spring');
set(gca,'Xtick',1:1:24,'XTickLabel',{'Evapotranspiration','Soil moisture',' Air Temperature','Total Runoff','Sensible Heat Flux','Soil Temperature',...
'Evapotranspiration','Soil moisture',' Air Temperature','Total Runoff','Sensible Heat Flux','Soil Temperature',...
'Evapotranspiration','Soil moisture',' Air Temperature','Total Runoff','Sensible Heat Flux','Soil Temperature',...
'Evapotranspiration','Soil moisture',' Air Temperature','Total Runoff','Sensible Heat Flux','Soil Temperature'});
set(gca,'XTickLabelRotation',90)
ylabel('Relative Change (%)')
grid on
ylim([-50 60])
applyhatch_plusC(gcf, '\-x.', 'rywg');
But I have received this error:
Undefined function or variable 'applyhatch_plusC'.
Error in relative_changes (line 23)
applyhatch_plusC(gcf, '\-x.', 'rywg');
Could somebody help me?
I would appreciate it if you help me.
0 Comments
Answers (1)
Rik
on 28 Sep 2021
Download the applyhatch_plusC function from the FileExchange here and add it to your path somewhere (or your current folder).
Note that it states it is only compatible with R2017a and later, so you might have to modify the code to make it work for R2015b.
0 Comments
See Also
Categories
Find more on Language Fundamentals 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!