How can I improve my plots including a dashed line

6 visualizaciones (últimos 30 días)
Ivan
Ivan el 16 de Oct. de 2024
Comentada: Sam Chak el 17 de Oct. de 2024
Hello, I am developing a code where I need to create a plot that incorporates fitted values on a semi-logarithmic scale on the x-axis, but I also need to insert a dashed line in the center of the plot (when y = 0). I am attaching an example of how I am doing it, but the line is not being displayed in the figure.
figure
semilogx(data_resi_inter.PGA1100,delta_ij_inter,'^r');
hold on
plot([0 0.6],[0 0],'k--','LineWidth',1.0) % dashed line
title('Delta term vs PGA1100');
subtitle('for Interface EQs & T = PGA');
ylabel('Delta_{ij}');
xlabel('PGA1100 [g]');
grid on
On the other hand, I would like to know if there is a way to make all the figures (which in my case are 6 of the same type) appear on the screen at the same time, without having to close one to see the next.
I have already used the 'subplot' function, but I also need to use the 'print' command, and the figures are not saved with sufficient quality for proper viewing.

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Oct. de 2024
semilogx(data_resi_inter.PGA1100,delta_ij_inter,'^r');
The x axis is being set to log.
plot([0 0.6],[0 0],'k--','LineWidth',1.0) % dashed line
You ask to plot starting from 0 on a log x axis. That is an implicit request to plot from -infinity (log(0) == -infinity). No line will be drawn when a coordinate is nan or inf.
You need to start your plot from a positive real coordinate.
  8 comentarios
Ivan
Ivan el 16 de Oct. de 2024
And if you know anything about the error bars shown in the image, that would also be very helpful.
Sam Chak
Sam Chak el 17 de Oct. de 2024
You can learn more in the documentation of ylabel():
However, plotting error bars is uncommon in my field, as most phenomena can be modeled with deterministic mathematical equations, provided they align with the governing equations of physics. Therefore, insignificant errors are often neglected, as they typically do not pose a threat to human safety or asset value. Moreover, there are predictive and corrective algorithms available as backups.
Have you not found any information about error bars on mathworks.com?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by