panel plots not working

I am new to RStudio and am having difficulty with what I think are called panel plots. Where I think the program bounces is on the line panel=function(x,y,z, ...) { There is no symbol between the closed round braket and the open curly bracket? If this works, please help. Thks

print(spplot(uk.grid, zcol="var1.pred",

  • col.regions=bpy.colors(64),
  • pretty=T, cuts=8,
  • main="UK predictions, Co (ppm)",
  • panel=function(x,y,z, ...) {
  • panel.levelplot(x, y, z, ...)
  • panel.grid(h=-1,v=-1, col="gray", lty=1)
  • panel.points(coordinates(,
  • cex=3*$Co/max($Co),
  • pch=1, col="white")
  • }))

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.


If you've never heard of a reprex before, you might want to start by reading the help page. The reprex dos and don'ts are also useful.

There's also a nice FAQ on how to do a minimal reprex for beginners, below:

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "")

For pointers specific to the community site, check out the reprex FAQ.

Are you talking about the panel functions in the lattice package? The gstat package only has two panel functions listed in the function reference:

If you're working with data that is built into a package you're attaching, then it should be easy to use in a reprex. Please see the links in my earlier response.

Also, please take a moment to familiarise yourself with our site's homework policy (see below):

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.