fplot add an undesired line
4 views (last 30 days)
Show older comments
Radu Trimbitas
on 5 Feb 2020
Answered: Star Strider
on 5 Feb 2020
When I use fplot with LineWidth a dashed thick gray line appears on the right edge o the box. Example
h=fplot(@(u) u.*exp(u),[-6,1],'r-','LineWidth',3)
![fplotbug.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270154/image.png)
Without Linewidth the picture is OK
0 Comments
Accepted Answer
Star Strider
on 5 Feb 2020
The gray line (that is always present (although it changes with the LineWidth parameter) indicates that the function increases or decreases without bound at that point.
There is no direct way to remove it, however you can get the XData and YData values from the fplot function and plot them separately:
figure
h=fplot(@(u) u.*exp(u),[-6,1],'r-','LineWidth',3);
figure
plot(h.XData, h.YData, '-r', 'LineWidth',2)
The gray dashed line is now gone from the second plot.
0 Comments
More Answers (0)
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!