Unexpected line colors when saving simple plot
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to plot some lines with various shades of gray and find some unexpected results.
Matlab plot window expected: gray figure background y1 gray (invisible against background) y2 gray (barely visible against background) y3 white y4 white
Saved plot expected: same line colors, but against white background instead
Matlab plot observed: same as expected
Saved plot observed: white background - OK y1 not visible - WHY? y2 light gray - OK y3 white on white = not visible - OK y4 black - WHY?
clear all
x = linspace(0,1,100);
y1 = sin(20*x);
y2 = sin(20*x) + 0.5*x;
y3 = x;
y4 = x.^2;
figure
hold on
plot(x, 0*x, 'k');
plot(x, y1, 'color', [0.8, 0.8, 0.8]);
plot(x, y2, 'color', [0.83, 0.83, 0.83]);
plot(x, y3, 'color', [0.999, 0.999, 0.999]);
plot(x, y4, '-w');
axis off
print('-dpng', 'test')
Thanks for your input! - John
Matlab 8.0.0.783 (R2012b) Mac OS 10.8.5
0 件のコメント
回答 (1 件)
Star Strider
2014 年 7 月 30 日
See if specifying a different renderer makes a difference:
print('-dpng', '-painters', 'test')
There are also other options you can experiment with.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!