[R] lattice contourplot: how to change line width?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Wed Nov 17 19:06:01 CET 2021


Your code is unnecessarily complex.
contourplot() will by default use the panel.contourplot() function and pass
down graphical arguments to it.

So this suffices:
contourplot(Z ~ X*Y, data = df, cuts = 3, lwd =2)

Customization of the panel function appears to be unnecessary for your
needs.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Nov 17, 2021 at 1:42 AM Luigi Marongiu <marongiu.luigi using gmail.com>
wrote:

> sorry, it was easier than expected: just add `lwd` to the main cal.
> sorry I could not stop the message before checking...
>
> On Wed, Nov 17, 2021 at 10:31 AM Luigi Marongiu
> <marongiu.luigi using gmail.com> wrote:
> >
> > Hello,
> > I have generated a contourplot with lattice. How do I set the line
> > width? I tried with:
> > ```
> > library(lattice)
> > contourplot(Z ~ X*Y, data = df, cuts = 3,
> > panel=function(x,y,...){
> > panel.contourplot(lty=1, lwd = 3)
> > })
> > ```
> > but did not work...
> > Thank you
>
>
>
> --
> Best regards,
> Luigi
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list