Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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 comentarios
Ellen
Ellen el 2 de Dic. de 2023
Movida: madhan ravi el 2 de Dic. de 2023
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 el 2 de Dic. de 2023
Movida: madhan ravi el 2 de Dic. de 2023
I attached the full file with the mat file it created.

Iniciar sesión para comentar.

Respuestas (1)

VBBV
VBBV el 2 de Dic. de 2023
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 comentarios
VBBV
VBBV el 3 de Dic. de 2023
Editada: VBBV el 3 de Dic. de 2023
% 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 el 3 de Dic. de 2023
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

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by