export_fig Warning: RGB color data not yet supported in Painter's mode

1 view (last 30 days)
Hi!
I'm using the function 'export_fig' to save my figures in pdf format. When I try to save, it shows me this error:
"Warning: RGB color data not yet supported in Painter's mode
In legendcolorbarlayout>doParentResize at 335
In /usr/site/hpc/x86_64/glibc-2.5/generic/matlab/R2011a/toolbox/matlab/graphics/hardcopy.p>hardcopy at 22
In graphics/private/render at 142
In print>LocalPrint at 271
In print at 228
In print2eps at 42
In export_fig at 377
In vertical_plot at 404
In main_function at 166"
This Warning is repeated for maybe 30 times. Then the figure is saved to pdf, but the contourplot is missing. -only the edges of the contourplot are visible. You can download the original figure and the pdf file on this link:
How can I fix this problem?
Im using MATLAB 7.12.0 (R2011a) on a supercomputer. Ghostscript 8.70-6.e15 is installed.
Thank you!
-Michael
  1 Comment
Walter Roberson
Walter Roberson on 3 Nov 2011
Your link is to a .rar file, which reduces the number of people who will download it. For example my system does not handle .rar files.

Sign in to comment.

Accepted Answer

Qiaonan Duan
Qiaonan Duan on 25 Jul 2013
Edited: Qiaonan Duan on 25 Jul 2013
My solution is to add all your colors to colormap. Then index them when ploting.
For example, for a scatter plot:
cmap = .....; %self defined colormap
colorIdx = ....; %map color to each dot by index
colormap(cmap); %change colormap variable to customized colormap
scatter(X,Y,s,colormap); % This scatter plot is able to export as eps.

More Answers (4)

Jan
Jan on 3 Nov 2011
This is not a problem of export_fig, but of the export of vector graphics: With the OpenGL and ZBuffer renderers you can create nice 3D graphics using RGB values to define the colors of objects. But then you can export pixel graphics only.
To create scalable vector graphics for the PDF export, the Painters renderer is used. But then you cannot use a Z-buffer painting, transparency and shaded RGB colors.
But you can use indexed colors with the Painters renderer, see Solution 1-6OTPQE
  1 Comment
Spigge
Spigge on 7 Aug 2014
The post is old but this issue continues to cause problems. I want to export to pfd or eps but I get the same warnings (42 of them to be precise) and a poor quality as a result. How can I identify ALL objects that need to be coverted to indexed color? I have several hundered graphical objects of different types in my application. I have tried using findall(gcf,'type','patch') but only 12 out of the 42 warnings seem to be caused by patch objects. What else should I look for and can I use the same fix as Solution 1-6OTPQE for all types of identified objects?
Thanks
Fredrik

Sign in to comment.


Walter Roberson
Walter Roberson on 3 Nov 2011
Before calling export_fig, try
set(gcf, 'Renderer', 'zbuffer')
drawnow();

Michael Backmann
Michael Backmann on 3 Nov 2011
@Walter: your solution didn't work. but thanks anyway!
@Jan: that was to much input for me! I tried to copy the example of "Solution 1-6OTPQE" directly above the export_fig line, but all stays the same.
Could you please take a look on my plotting file. maybe you find the error. here is the m-file:
-The figure plot is on line 31. The contour plot is on line 133-200 (for variable 'pr') and i try to save the plot on line 396-408.
I'm so confused! please help!
thx, -michael

Oliver Woodford
Oliver Woodford on 25 Mar 2012
I added a paragraph in this issue to the export_fig webpage: http://sites.google.com/site/oliverwoodford/software/export_fig

Categories

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