フィルターのクリア

What command do i need after de hold off fuction to print the labels in my plot?

5 ビュー (過去 30 日間)
Ellen
Ellen 2023 年 12 月 2 日
コメント済み: Ellen 2023 年 12 月 3 日
kin_sector=[meteo.data.sector]';
figure(1)
fs=11;
set(gca,'FontSize', fs)
cc=jet(noy);
hold on
.........% I left the correct working part of the plot.
hold off
xlabel('wind direction')
ylabel('annual mean sectorial wind energy (MJ)')
title('1996 - 2022 Vlissingen')
axis([0.4 8.6 0 0.9])
set(gca,'xtick',1:1:8,'FontSize',fs)
set(gca,'XTickLabel',{'N','NE','E','SE','S','SW','W','NW'},'FontSize',fs)
box on
grid on
orient portrait
print -dpng -r400 windclimate_allyears.png
this is the last part of my code from aan older version of matlab. after hold off the script seems to stop. Do I need a special command in my matlab version? Or do I have to put the code for the labels etc at an other place in the script?
this is the plot that is printed but no labels
kind regards Ellen
  3 件のコメント
Ellen
Ellen 2023 年 12 月 2 日
移動済み: madhan ravi 2023 年 12 月 2 日
that seems not to be the solution. Probably the erro lies in de plot code
hold on
for j=1:noy % divide by 1e6 to get energy in MJ
bar(1:nos,kin_sector(j,:)/1e6,'FaceColor','none','EdgeColor',cc(j,:),'LineWidth',1.5);
%for k=1:15
% sh=(k-8)*0.025;
%plot(1+sh:nos+sh,kin_sector(j,:)/1e6,'s','Color',cc(j,:),'MarkerFaceColor',cc(j,:),'MarkerSize',2);
%end
plot(1:nos,mean(kin_sector,1)/1e6,'k s','MarkerFaceColor','k','MarkerSize',12);
end
% highlight 1996 & 2015 & 2018
% year=1;
% plot([0.5:1:7.5], kin_sector(year,:)/1e6,'>','Color',cc(year,:),'MarkerFaceColor',cc(year,:),'MarkerSize',6) %
% year=20;
% plot([0.5:1:7.5], kin_sector(year,:)/1e6,'>','Color',cc(year,:),'MarkerFaceColor',cc(year,:),'MarkerSize',6) %
% year=23;
% plot([0.5:1:7.5], kin_sector(year,:)/1e6,'>','Color',cc(year,:),'MarkerFaceColor',cc(year,:),'MarkerSize',6) %
year=1;
plot(0.5:1:7.5, kin_sector(year,:)/1e6,'>','Color','k','MarkerFaceColor','k','MarkerSize',6) %
year=2;
plot(0.5:1:7.5, kin_sector(year,:)/1e6,'>','Color','k','MarkerFaceColor',[0.6 0.6 0.6],'MarkerSize',6) %
year=3;
plot(0.5:1:7.5, kin_sector(year,:)/1e6,'>','Color','k','MarkerFaceColor','w','MarkerSize',6) %
year=4;
plot(0.5:1:7.5, kin_sector(year,:)/1e6,'>','Color','k','MarkerFaceColor','r','MarkerSize',6) %
year=5;
plot(0.5:1:7.5, kin_sector(year,:)/1e6,'>','Color','k','MarkerFaceColor','r','MarkerSize',6) %
hold off
Ellen
Ellen 2023 年 12 月 2 日
移動済み: madhan ravi 2023 年 12 月 2 日
I attached the full file with the mat file it created.

サインインしてコメントする。

回答 (1 件)

VBBV
VBBV 2023 年 12 月 2 日
print('-image','-dpng', 'windclimate_allyears.png')
Try using the OpenGL graphics rendering format as above. The version of Matlab you have probably used the vector format which can cause stray lines to appear and label issues in the plot
  5 件のコメント
VBBV
VBBV 2023 年 12 月 3 日
編集済み: VBBV 2023 年 12 月 3 日
% axis([0.4 8.6 0 0.9)])
Comment the axis line since this limits the y-axis values always to 0.9.
The bar plot produces values which are greater than 0.9.
Ellen
Ellen 2023 年 12 月 3 日
You mean I have to give 0.9 another value for example the 600 wich is te highest Y value in the former diagram?
I ll try that.
thks Ellen

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by