Missing patch face color of the plot at its original size

6 views (last 30 days)
Hi,
I am working on plots with shaded error bars. I set up different colors for the shaded error bar through property editor with FaceAlpha to be set at 0.2. However, when I am viewing the whole plot at its original size, the shaded color went missing. If I zoom in really closely and occasionally the shaded color will show up (some don't). Does anyone know how I can get around this issue?
Thank you very much in advance.
zoomed in vs. original

Answers (1)

Ayush Aniket
Ayush Aniket on 29 Sep 2023
Hi jolnoo,
As per my understanding this issue may be due to the renderer used by MATLAB to display the figures. MATLAB has several renderers, and some of them may not handle transparency (the `FaceAlpha` property) correctly at all zoom levels.
You can try changing the renderer used by MATLAB to display your figures. The 'painters' renderer is often better at handling transparency. You can set the renderer for a figure using the `set` function as shown below:
set(gcf, 'renderer', 'painters');
You should call this line of code after creating your figure but before calling `shadedErrorBar` (or whatever function you're using to create the shaded error bars). To read more about the 'renderer' property, refer to the following link:
If changing the renderer doesn't help, another workaround is to save your figure as a vector graphics file (such as .pdf or .eps), which should correctly display the transparency at all zoom levels as shown below:
%'filename.eps' for .eps file
print(gcf,'-dpdf','filename.pdf');
For more information about saving a figure with different options, you can refer to the following link:
Hope it helps.

Categories

Find more on Data 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!