Figure marker colors change slightly on export

2 次查看(过去 30 天)
I'm creating a figure with marker colors defined using custom rgb identifiers in the 0 to 1 format (e.g. [.1 0 .6]). Upon save with the print() or saveas() functions, the colors are slightly altered.
I assume this is because upon export, MatLab defaults to some standard 256 color palette and changes the colors to closest fit. How can I circumvent this and keep the exact colors I've defined?
Thank you
(Using MatLab2015a)

回答(2 个)

Mahdiyar
Mahdiyar 2015-4-5
编辑:John Kelly 2016-5-19
Somtimes, since the computer has not the font that you are using in the matlab, it may cause such a problem like this.
If you need to save the figure exactly the same as you see on the figure, it would be better to use some kind of tools like Snniping in windows to take the photo from the screen with high resolution. Of course, if you do not have many figures.
Regards,
  1 个评论
Jan
Jan 2015-4-5
The problem of the OP does not concern the fonts or the resolution, but only the colors.

请先登录,再进行评论。


Jan
Jan 2015-4-5
Matlab does not use a 256 color palette. RGB values remain exactly as they are defined, except if you modify them explicitly, e.g. when you export the contents of the figure to a 256-color PNG. So please post the code you are using for the export and explain how you detect the changes. Perhaps only the tool, which opens the images afterwards modify the colors.
  1 个评论
MDShhhh
MDShhhh 2015-4-5
I visually detect the changes in Apple's standard image viewer, Preview. If I take a screenshot of the figure produced in MatLab's viewer, load that in Preview, and place it directly next to the printed figure file loaded by Preview, they are visibly different. See attached file:
Below is the code:
figure;
hold on
scatter(x1, y1, [], [.1 0 .6], 'filled')
scatter(x2, y2, [], [1 .3 .1], 'filled')
scatter(x3, y3, [], [.6 .3 1], 'filled')
set(gcf,'PaperType', 'uslegal');
set(gcf,'PaperOrientation','landscape');
set(gcf,'PaperUnits','normalized');
set(gcf,'PaperPosition', [0 0 1 1]);
print(gcf, '-dpdf', 'Figures\Test.pdf');

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by