How can I improve my plots including a dashed line

3 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2024-10-16
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 个评论
Ivan
Ivan 2024-10-16
And if you know anything about the error bars shown in the image, that would also be very helpful.
Sam Chak
Sam Chak 2024-10-17
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?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by