MATLAB Answers

How do I troubleshoot if a plot line doesn't show up on a figure

1 view (last 30 days)
Oscar Ramos
Oscar Ramos on 18 Sep 2020
Commented: Star Strider on 18 Sep 2020
Due to the nature of the problem requiring a large sum of data, I can't provide an example code beyond this.
plot([0 7],[meet4060 meet4060],':k')
Where meet4060=55.
It worked in the original code I was working on and it worked in a separate figure on its own, but it is not showing up in the recent code. When this happens, what should I be looking for to begin solving the trouble?


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 18 Sep 2020
It plots a horizontal dotted line at 55 from 0 to 7.
If it works independently, then there are several possibilities, some of which are that the plot limits are such that it is there, however is either too short to be seen clearly, or outside of the plot limits (xlim, ylim) entirely, or is being overplotted by something else.
One option would be to plot it temporarily as:
plot([0 7],[meet4060 meet4060],':k', 'LineWidth'10)
to see if it becomes visible.
We would need to see relevant parts of the current code to be certain.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!