Is it possible to create a contour plot with the isolines labeled. I know you can do this with Matlab. Argh! I tried creating a filled contour plot, then using par(new=T), followed by overlaying the contour plot on top. However, the placement of the filled contour plot and the contour plot do not align correctly. Any suggestions would be appreciated. Thanks, Jon -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3056437.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
On Nov 23, 2010, at 6:25 PM, jt306 wrote:> > Is it possible to create a contour plot with the isolines labeled. > I know > you can do this with Matlab. Argh!It is fairly straightforward with lattice::levelplot. Provide some sample data.> > I tried creating a filled contour plot, then using par(new=T), > followed by > overlaying the contour plot on top. However, the placement of the > filled > contour plot and the contour plot do not align correctly. Any > suggestions > would be appreciated. > > Thanks, > Jon >-- David Winsemius, MD West Hartford, CT
jt306 wrote:> > Is it possible to create a contour plot with the isolines labeled. I know > you can do this with Matlab. Argh! > > I tried creating a filled contour plot, then using par(new=T), followed by > overlaying the contour plot on top. However, the placement of the filled > contour plot and the contour plot do not align correctly. Any suggestions > would be appreciated. > > Thanks, > Jon > > > >Jon, I don't use filled.contour but image and then contour. Try this. image(volcano) contour(volcano,add=TRUE) Is this what you want? Regards, Fiona -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3058974.html Sent from the R help mailing list archive at Nabble.com.
If you usre filled.contour, then use contour() as a part of the function supplied as the axis parameter, you can correctly overlay contours on the colour contour plot. Steve e -----Original Message----- From: Fiona Berryman <f.berryman at wlv.ac.uk> To: <r-help at r-project.org> Sent: 11/25/2010 13:57:06 Subject: Re: [R] Filled contour plot showing labeled isolines? jt306 wrote:> > Is it possible to create a contour plot with the isolines labeled. Iknow> you can do this with Matlab. Argh! > > I tried creating a filled contour plot, then using par(new=T),followed by> overlaying the contour plot on top. However, the placement of thefilled> contour plot and the contour plot do not align correctly. Anysuggestions> would be appreciated. > > Thanks, > Jon > > > >Jon, I don't use filled.contour but image and then contour. Try this. image(volcano) contour(volcano,add=TRUE) Is this what you want? Regards, Fiona -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3058974.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
Thanks Fiona, This is the right idea, but I would like to have the colors smoothed out similar to what filled.contour does. Jon -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3060915.html Sent from the R help mailing list archive at Nabble.com.
Thanks Steve. Could you please give me an example of what the command for doing that would look like? -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3060925.html Sent from the R help mailing list archive at Nabble.com.
I know this answer is really late, but I dont think this post was answered properly. It seems like such obvious thing to want to do, you would think it would be easy... Well, it is! Once you know how (of course). Hooray! This took me ages to figure this out too! The answer is writen right there in the help file, but it isnt obvious. This is the code from the help file ?filled.contour : ------------------------------------------------ # Annotating a filled contour plot a <- expand.grid(1:20, 1:20) b <- matrix(a[,1] + a[,2], 20) filled.contour(x = 1:20, y = 1:20, z = b, plot.axes={ axis(1); axis(2); points(10,10) }) ------------------------------------------------ Instead of "points(10,10)" add whatever you want to plot! So to add contour lines use this instead: ------------------------------------------------ # Adding contour lines to a filled contour plot a <- expand.grid(1:20, 1:20) b <- matrix(a[,1] + a[,2], 20) filled.contour(x = 1:20, y = 1:20, z = b, plot.axes={ axis(1); axis(2); contour(x = 1:20, y = 1:20, z b, add=T) }) ------------------------------------------------ Done! Happy plotting. -- View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p4639849.html Sent from the R help mailing list archive at Nabble.com.