Having error when ploting bars with filled pattern

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Rik
Rik il 28 Set 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.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti


Release

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by