# Plot a time series plot in customized rectangle

2 vues (au cours des 30 derniers jours)
Sujata Dhar le 2 Avr 2024
Commenté : Sujata Dhar le 2 Avr 2024
I am plotting a time series from the attached data.
plot(time,pm_1,'b-','LineWidth',3);
I am getting the following plot (plot_xp.png). But I want my plot to be in a rectangle window like the attached (desired_plot.png). Can you please help me with the necessary changes.
Thank you very much
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
nathan blanc le 2 Avr 2024
Modifié(e) : nathan blanc le 2 Avr 2024
I think if you just write:
plot(time,pm_1);
grid off
and change the size of the figure window a bit, you will get what you want. You can also play around with hte colors and linewidths. for example
plot(time,pm_1,'r-','LineWidth',1);
will give you a red line with a line width of 1

Connectez-vous pour commenter.

### Réponse acceptée

Adam Danz le 2 Avr 2024
Previous answers suggest changing the size of the figure window which is one solution.
Another solution is to set the size of the axes or the PlotBoxAspectRatio.
Take this sine curve for example.
th = 0:.1:120;
figure()
plot(sin(th))
Next, define the aspect ratio of the axes such that the x axis is 5 times longer than the y axis. I'll ignore the z axis since this is a 2D plot.
figure()
ax = gca;
plot(sin(th))
ax.PlotBoxAspectRatio(1:2) = [5,1]; % 5:1 x:y
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Sujata Dhar le 2 Avr 2024
Thank you

Connectez-vous pour commenter.

### Plus de réponses (2)

KSSV le 2 Avr 2024
Modifié(e) : KSSV le 2 Avr 2024
plot(time,pm_1,'b','LineWidth',1); % You may change line width
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

nathan blanc le 2 Avr 2024
Modifié(e) : nathan blanc le 2 Avr 2024
nathan blanc about 2 hours ago
Edited: nathan blanc about 2 hours ago
plot(time,pm_1);
grid off
and change the size of the figure window a bit, you will get what you want. You can also play around with hte colors and linewidths. for example
plot(time,pm_1,'r-','LineWidth',1);
will give you a red line with a line width of 1
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

R2023b

### Community Treasure Hunt

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

Start Hunting!

Translated by