我尝试使用export_fig matlab工具以矢量格式(pdf或eps)导出matlab数字。
尝试这样做时,我得到"警告:在Painter"模式中不支持RGB颜色数据。并且没有显示任何有色部分。
作者已使用
在README.md(包中)中解决了这个问题**RGB color data not yet supported in Painter's mode** - you will see this as a warning if you try to export a figure which contains patch objects whose face or vertex colors are specified as a an RGB colour, rather than an index into the colormap, using the painters renderer (the default renderer for vector output). This problem can arise if you use `pcolor`, for example. This is a problem with MATLAB's painters renderer, which also affects `print`; there is currently no fix available in export_fig (other than to export to bitmap). The suggested workaround is to avoid colouring patches using RGB. First, try to use colours in the figure's colourmap (instructions [here](http://www.mathworks.co.uk/support/solutions/en/data/1-6OTPQE/)) - change the colourmap, if necessary. If you are using `pcolor`, try using [uimagesc](http://www.mathworks.com/matlabcentral/fileexchange/11368) (on the file exchange) instead.
在http://www.mathworks.co.uk/support/solutions/en/data/1-6OTPQE/我们已经接受了解决方案
s = surf(peaks(50), 'CData', cat(3, 0.8*ones(50), ones(50), 0.65*ones(50)));
rgb_colors = get(s, 'CData');
[i, map] = rgb2ind(rgb_colors, 64);
set(s, 'CData', double(i));
colormap(map);
现在我有一个有一些轮廓线的图形,问题可能是我访问它们的句柄的方式,因为尝试这个:
>> h = findobj(gca, 'Type', 'Line')
h =
Empty matrix: 0-by-1
即。没有找到行。所以我现在正在使用它:
>> h = get(gca, 'children')
然后,为了转换颜色,我将使用论坛帖子中的后续行,这会产生错误:
>> [i, map] = rgb2ind(rgb_colors, 64)
Error using cq
First input must be a uint8 array.
Error in rgb2ind (line 89)
[map,X] = cq(RGB,m);
我还会输出rgb_colors的内容:
>> rgb_colors
rgb_colors =
[2x451x3 double]
[2x480x3 double]
[2x359x3 double]
[2x311x3 double]
[2x279x3 double]
[2x263x3 double]
[2x259x3 double]
[2x253x3 double]
[2x261x3 double]
[2x269x3 double]
[2x260x3 double]
[2x261x3 double]
[2x261x3 double]
[2x259x3 double]
[2x263x3 double]
[2x259x3 double]
[2x259x3 double]
[2x253x3 double]
[2x255x3 double]
[2x255x3 double]
[2x255x3 double]
[3x34577x3 double]
[]
我很抱歉,如果这是非常基本的,我在matlab上没有多少经验。