フィルターのクリア

Dashed contours in a .eps figure appear solid

3 ビュー (過去 30 日間)
Jason
Jason 2011 年 2 月 3 日
I am producing some figures for a publication and I am looking to create a contour plot with positive values in solid contours, negative values in dashed contours, and then shading for 95% significant values. I have set up the code to do this, but the dashed contours do not appear in the figure on screen or in the saved .eps file.
Here is the code I have used:
figure(1);
colormap(getpmap(4)); %This is a special colormap I have.
contourf(sst.lon,sst.lat,siglev,0.99:0.01:1.01);
contour(sst.lon,sst.lat,siglev,0.99:0.01:1.01);
contour(sst.lon,sst.lat,sst.cCPW(:,:,13).*sst.mask,...
-0.9:0.2:-0.1,'k--','LineWidth',2);
contour(sst.lon,sst.lat,sst.cCPW(:,:,13).*sst.mask,...
0.1:0.2:0.9,'k-','LineWidth',2);
print('SST_Correlation.eps','-depsc','-loose','-r1200');
Of course the problem is that the dashed lines appear as solid. I have read that this is an issue with the painters renderer, but when I switch to another renderer (zbuffer or opengl) and try to render a .eps, the file is gigantic in size. I tried rendering as a .jpg and .png but the quality of the image is not that great.
Can anyone help me with getting a .eps file (of reasonable size) with the dashed contours showing correctly?
  1 件のコメント
Oliver Woodford
Oliver Woodford 2011 年 2 月 4 日
Jason, no need to put "Help" in your question. Every question is asking for help! Also, your code cannot be run by anyone - we don't have getmap, stt or siglev. Can you change it for a simple script that exhibits the same problem and can be run by anyone with a standard MATLAB installation?

サインインしてコメントする。

回答 (2 件)

Bjorn Gustavsson
Bjorn Gustavsson 2011 年 10 月 24 日
Ok, I just happened to have to deal with this ordeal. Here is a solution that gets the job done:
% Make the contours (and let matlab draw them):
[c1,h1] = contour(x,y,Z,'k-');
% Take all the info from the contourline output argument:
i0 = 1;
i2 = 1;
while i0 < length(cc1)
i1 = i0+[1:cc1(2,i0)];
zLevel(i2) = cc1(1,i0);
hold on
% And plot it with dashed lines:
ph(i2) = plot(cc1(1,i1),cc1(2,i1),'k--','linewidth',2);
i0 = i1(end)+1;
i2 = i2+1;
end
% Scrap the contourlines:
delete(h1)
Then continue with personal decorations et al.
HTH.

Jan
Jan 2011 年 2 月 4 日
You can insert NaNs in your data. The corresponding points are not drawn:
a = peaks;
a(rand(size(a)) < 0.1) = NaN;
[c, h] = contour(a);
For complicated data, this might be impossible, because it is hard to find suiting positions for the gaps.

カテゴリ

Help Center および File ExchangeSurfaces, Volumes, and Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by