How can I modify the blurry line of the graph?

11 views (last 30 days)
Hello, I have a question about line.
The results of the previously working graph were derived as distinct lines, but when trying to derive them again using the same coding, the lines of the graph changed blurryly.
How can I modify this graph to a distinct line?
<previously working graph>
<present working graph>

Answers (1)

Maneet Kaur Bagga
Maneet Kaur Bagga on 23 Feb 2024
Hi,
If you're experiencing blurry lines in your graph where they were distinct before, the possible workaround for this could be:
  • To make the lines more distinct, you can increase the line width when plotting:
plot(x, y, 'LineWidth', 2);
  • MATLAB uses different renderers to display graphics. If the lines are blurry, you can try changing the renderer:
set(gcf, 'Renderer', 'painters'); % Other options include 'opengl' and 'zbuffer'
  • When saving the figure, you can specify a higher resolution:
print('output','-dpng','-r300'); % Saves the figure as a PNG with 300 DPI
  • For the best quality, especially when you need to zoom in without losing clarity, save the figure in a vector format:
print('output','-dsvg'); % Saves the figure as an SVG file
You can also check for "Anti-aliasing" option: Although MATLAB typically handles anti-aliasing automatically, but if you suspect this is causing issues, you might need to adjust your system's graphics settings.
Hope this helps!

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!