Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!h30g2000vbr.googlegroups.com!not-for-mail
From: Brendan <brendandetracey@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: contour plot with dashed linespec
Date: Wed, 9 Sep 2009 05:37:19 -0700 (PDT)
Organization: http://groups.google.com
Lines: 72
Message-ID: <fbd02f28-0bff-4407-89c4-6d4d511be95b@h30g2000vbr.googlegroups.com>
References: <h86ikc$cmq$1@fred.mathworks.com> <b2ecbdf8-190b-4abd-a9d4-5a08a20f6e21@o21g2000vbl.googlegroups.com> 
	<h873o2$pls$1@fred.mathworks.com>
NNTP-Posting-Host: 24.222.3.178
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1252499839 28560 127.0.0.1 (9 Sep 2009 12:37:19 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 9 Sep 2009 12:37:19 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: h30g2000vbr.googlegroups.com; posting-host=24.222.3.178; 
	posting-account=B-TRNQoAAACbFTAQWrEB2ZKtNl2Jbw6S
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; 
	.NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; 
	.NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 
	3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:569239


On Sep 8, 11:26 pm, "Paul Ullrich" <ayca...@gmail.com> wrote:
> Brendan <brendandetra...@yahoo.com> wrote in message <b2ecbdf8-190b-4abd-a9d4-5a08a20f6...@o21g2000vbl.googlegroups.com>...
> > On Sep 8, 6:34?pm, "Paul Ullrich" <ayca...@gmail.com> wrote:
> > > Hi all,
>
> > > I've recently been plotting fluid flows using MATLAB's contour command and wanted to separately identify contour lines of positive and negative using solid and dashed linespec, respectively. ?I have been using the following command to do so:
>
> > > contour(Lon, Lat, Ubig, 'LevelList', 1e-5*[1:2:15], 'LineColor', 'black', 'ShowText', 'off');
> > > hold on;
> > > contour(Lon, Lat, Ubig, '--', 'LevelList', 1e-5*[-15:2:-1], 'LineColor', 'black', 'ShowText', 'off');
> > > hold off;
>
> > > However, using these commands the negative contour lines actually appear solid in my plots:
>
> > >http://www-personal.umich.edu/~paullric/BadPlot.png
>
> > > I can use : as a linespec instead, in which case I get
>
> > >http://www-personal.umich.edu/~paullric/DotPlot.png
>
> > > which at least lets me identify the negative regions, but is harder to read. ?Is there any way I can fix this?
>
> > Since you are not using colours, I presume you have the need to print
> > on a non-colour printer. Try using a different renderer for your
> > figures.
> > set(gcf, 'Renderer', 'painters')
> > set(gcf, 'Renderer', 'zbuffer')
> > set(gcf, 'Renderer', 'opengl')
> > Trying a different renderer can effect how dashed line patterns
> > appear. Try using zbuffer and then print -dpng -r300 myfig.png
> > Using painters with a postscript file can make dots appear very small
> > (iirc on windows at least).
>
> > Back in the day, being able to set customised dash line patterns was
> > one of the (very) few advantages of NCAR graphics. Wish Matlab could
> > do the same.
>
> Thanks for the suggestion.  The dashed lines look perfect using either zbuffer or opengl, but if I try to export the resulting image to a eps file or pdf file the lines are not smooth (unlike with the painters renderer).  Thoughts?- Hide quoted text -
>
> - Show quoted text -

You are pretty much stuck with bad dots when exporting to a vector
format like postscript, eps, pdf etc. Your only solution is to export
to a bitmap format, as I stated above. You could also try one of the
other two dashed line patterns. If you are not opposed to gray scale,
then you could first use contourf with a two colour colourmap. Sample:
z = peaks(100);
colormap([0.9 0.9 0.9 ; 1 1 1])
contourf(z,'LineStyle','none');
caxis([-10 10])
hold on
contour(z,[0:8],'k');
[c,h] = contour(z,[-8:0]);
set(h,'LineStyle',':','LineColor','k')
contour(z,[0 0],'k','LineWidth',2);
hold off

With this, for the negative lines you might not even want a dashed
line style, or you might set them to white. You have to play around to
find what looks best. Try making the dashed lines thicker, or use
heavier lines to denote positive values.