Hello,
I need to save my pie charts without white background behind it (transparent), I was searched dozens of webpages and tried:
set(gcf, 'color', 'none');% and
set(gca 'color', 'none');
export_fig (ax, ['filename' num2str(k) '.png']);
But I got this error:
Unrecognized function or variable 'using_hg2'.Error in export_fig>parse_args (line 1391) options.aa_factor = 1 + 2 * (~(using_hg2(fig) && isAA) | (options.renderer == 3));Error in export_fig (line 330) [fig, options] = parse_args(nargout, fig, varargin{:});
Here is all my code,
clff = figure();ax = axes();p = pie(ax, ones(1,5)); t = p(2:2:end); p = p(1:2:end); delete(t)s = {'CC', 'ME', 'NU', 'BI', 'IA'};for k=1:size(davar1, 1) for i=1:numel(s) switch davar1(k,:).([s{i} '_CHECK']) % I even tried insert (j) here and do it in the for loop but error says Index exceeds the number of array elements (2).
case 'New York' p(i).FaceColor = 'g'; case 'California' p(i).FaceColor = 'y'; case 'Illinois' p(i).FaceColor = 'r'; case 'Texas ' p(i).FaceColor = 'k'; case 'Ohio' p(i).FaceColor = 'b'; case 'North Carolina' p(i).FaceColor = 'c'; case 'Tennessee' p(i).FaceColor = 'w'; end end exportgraphics(ax, ['filename' num2str(k) '.png']);end
I saw some people say save figure as .png then go to windows Microsoft Office PowerPoint and make your picture background transparent but I have over 200 images and it would be awesome if Matlab can do it. Please guid me how I can export my figure in transparent mode.
Thank you all
Best Answer