Weird line to the right of box after saving the plot

3 vues (au cours des 30 derniers jours)
Han Lee
Han Lee le 22 Juil 2019
Modifié(e) : Adam Danz le 23 Juil 2019
I was plotting a graph and saved it to jpg using saveas
I used xlim to limit the range of x axis, but there are some line remain on the graph to the right of the graph.
This didn't show up in the figure box of MATLAB
but shows in the jpg file I save
please help me, thank you!
Here's the code I use
subplot(2,2,4)
yyaxis left
h(1) = plot(t_vec,Chiller_RAC_Load_Tons*3.5168525,'LineWidth',1);
hold on
ylabel('Chiller Power [kW]')
xlabel('Time')
yyaxis right
h(2) = plot(t_vec,Ptotal,'LineWidth',1);%Plotting HVAC Power
xlabel('Time')
ylabel('Fan Power [kW]')
title(sprintf('Chiller Power and Fan Power %s/%s/%d',Month_str,Date_str,Year))
hold on;
xline(E1_start,'LineWidth',1,'Color','black')
xline(E1_end,'LineWidth',1,'Color','black')
xline(E2_start,'LineWidth',1,'Color','black')
xline(E2_end,'LineWidth',1,'Color','black')
%legend(h(1:2),'Chiller Power','Fan Power')
xlim([5 20]);
xticks([7 9 11 13 15 17 19 21 23])
xticklabels({'7:00','9:00','11:00','13:00','15:00','17:00','19:00','21:00','23:00'})
set(gca, 'FontSize', 10);
saveas(gcf,sprintf('Chiller Tonnage and Fan Power %s-%d-%d.jpg',Month_str,Date,Year))
  3 commentaires
Han Lee
Han Lee le 23 Juil 2019
Thank you for your reply!Clipping didn't work, instead I switch the left two pictures with right two pictures and the lines disappeared.
Adam Danz
Adam Danz le 23 Juil 2019
Modifié(e) : Adam Danz le 23 Juil 2019
Hmmm it must have been a quark with the double axes. Glad you found a work around.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by