Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
faq:i_am_getting_strange_artifacts_in_figures_that_use_opacity [2011/04/19 10:40]
cristiano
faq:i_am_getting_strange_artifacts_in_figures_that_use_opacity [2017/08/17 11:21] (current)
Line 5: Line 5:
 The Matlab OpenGL renderer is very buggy when using opacity. Sometimes parts of your axes system disappear or colors are not drawn correctly, etc. , and some of these issues are especially prevalent when saving your figures as vectorized images using postscript (e.g.: *.eps). The Matlab OpenGL renderer is very buggy when using opacity. Sometimes parts of your axes system disappear or colors are not drawn correctly, etc. , and some of these issues are especially prevalent when saving your figures as vectorized images using postscript (e.g.: *.eps).
  
-One option is to manually specify the renderer, e.g.  ​+One option is to manually specify the renderer ​for your figure, e.g.  ​
   set(gcf, '​renderer',​ '​zbuffer'​); ​ % valid options are painters, zbuffer, opengl, none   set(gcf, '​renderer',​ '​zbuffer'​); ​ % valid options are painters, zbuffer, opengl, none
 +
 +To specify the renderer for all figures (e.g. at startup of MATLAB), do
 +  set(0, '​defaultrenderer',​ '​zbuffer'​);​
  
 Alternatively,​ in the functions **[[:​reference:​ft_singleplotER]]**/​**[[:​reference:​ft_singleplotTFR|TFR]]** and **[[:​reference:​ft_multiplotER]]**/​**[[:​reference:​ft_multiplotTFR|TFR]]** there is a way to bypass these errors by using cfg.maskstyle = '​saturation'​ (default = '​opacity'​). This uses saturation values to produce '​transparent'​ colors, which avoid the use of opacity in the OpenGL renderer. Colors are not actually transparent in the figure, which is why we are unable to implement a similar option in **[[:​reference:​ft_topoplotER]]**/​**[[:​reference:​ft_topoplotTFR|TFR]]**,​ **[[:​reference:​ft_sourceplot]]** and others (as they specifically require the use of transparent parts of figures). ​ Alternatively,​ in the functions **[[:​reference:​ft_singleplotER]]**/​**[[:​reference:​ft_singleplotTFR|TFR]]** and **[[:​reference:​ft_multiplotER]]**/​**[[:​reference:​ft_multiplotTFR|TFR]]** there is a way to bypass these errors by using cfg.maskstyle = '​saturation'​ (default = '​opacity'​). This uses saturation values to produce '​transparent'​ colors, which avoid the use of opacity in the OpenGL renderer. Colors are not actually transparent in the figure, which is why we are unable to implement a similar option in **[[:​reference:​ft_topoplotER]]**/​**[[:​reference:​ft_topoplotTFR|TFR]]**,​ **[[:​reference:​ft_sourceplot]]** and others (as they specifically require the use of transparent parts of figures). ​
  
 The advantage of using saturation is that you can also save it correctly to an *.eps file. The advantage of using saturation is that you can also save it correctly to an *.eps file.