Re: [R] Mapping 2D to 3D

2020-09-21 Thread Abby Spurdle
Hi H, I probably owe you an apology. I was just reading the geom_contour documentation. It's difficult to follow. Base R functions, my functions, and pretty much everyone's functions, take a matrix as input. But as far as I can tell, geom_contour wants a data.frame with three {x, y and z}

Re: [R] Mapping 2D to 3D

2020-09-20 Thread Abby Spurdle
> I was looking at this example which uses geom_contour(): > > ggvolcano = volcano %>% > reshape2::melt() %>% > ggplot() + > geom_tile(aes(x=Var1,y=Var2,fill=value)) + > geom_contour(aes(x=Var1,y=Var2,z=value),color="black") + > scale_x_continuous("X",expand = c(0,0)) + >

Re: [R] Mapping 2D to 3D

2020-09-20 Thread H
On 09/19/2020 04:33 PM, Abby Spurdle wrote: >> Understood > I'd recommend you try to be more precise. > >> I just began looking at the volcano dataset which uses geom_contour. > The volcano dataset does *not* use geom_contour. > However, the help file for the volcano dataset, does use the >

Re: [R] Mapping 2D to 3D

2020-09-19 Thread Abby Spurdle
> Understood I'd recommend you try to be more precise. > I just began looking at the volcano dataset which uses geom_contour. The volcano dataset does *not* use geom_contour. However, the help file for the volcano dataset, does use the filled.contour function, in its example. > I now realize

Re: [R] Mapping 2D to 3D

2020-09-19 Thread H
On 09/19/2020 12:42 AM, Jeff Newmiller wrote: > When dealing with a 2-d density plot, the z variable is a predefined function > of your x and y data, it is not something you can specify. If you want to > specify z, then you need to use geom_contour. You appear to need to study the > theory of

Re: [R] Mapping 2D to 3D

2020-09-18 Thread Jeff Newmiller
When dealing with a 2-d density plot, the z variable is a predefined function of your x and y data, it is not something you can specify. If you want to specify z, then you need to use geom_contour. You appear to need to study the theory of kernel density estimates, which is off topic here.

Re: [R] Mapping 2D to 3D

2020-09-18 Thread H
On 09/18/2020 03:08 AM, Carlos Ortega wrote: > Hi, > > There are some further references in the own "RStudio Community" and in > StackOverflow: > > * https://community.rstudio.com/t/options-to-stat-density-2d/792/4 > * >

Re: [R] Mapping 2D to 3D

2020-09-18 Thread H
On 09/18/2020 02:26 AM, Jeff Newmiller wrote: > No, but fortunately you are off in the weeds. Density has an > internally-computed "z" coordinate... you should be looking at ?geom_contour. > > On September 17, 2020 7:17:33 PM PDT, H wrote: >> I am trying to understand how to map 2D to 3D using

Re: [R] Mapping 2D to 3D

2020-09-18 Thread Carlos Ortega
Hi, There are some further references in the own "RStudio Community" and in StackOverflow: - https://community.rstudio.com/t/options-to-stat-density-2d/792/4 - https://stackoverflow.com/questions/32206623/what-does-level-mean-in-ggplotstat-density2d Kind Regards, Carlos. On Fri, Sep

Re: [R] Mapping 2D to 3D

2020-09-18 Thread Jeff Newmiller
No, but fortunately you are off in the weeds. Density has an internally-computed "z" coordinate... you should be looking at ?geom_contour. On September 17, 2020 7:17:33 PM PDT, H wrote: >I am trying to understand how to map 2D to 3D using ggplot() and >eventually plot_gg(). I am, however, stuck

Re: [R] Mapping 2D to 3D

2020-09-18 Thread Abby Spurdle
> But there's no reason for the user to do that when using the plotting > function. I should amend the above. There's no reason for the user to do that (compute a third "variable" representing density), if using a high level plotting function, that's designed to compute the density for you. It

Re: [R] Mapping 2D to 3D

2020-09-18 Thread Abby Spurdle
I'm not familiar with the gg graphics system. However, I am familiar with density estimation, and density visualization. There is *no* third variable, as such. But rather, density estimates, which in this context, would usually be a matrix. (And are computed inside the plotting or density

[R] Mapping 2D to 3D

2020-09-17 Thread H
I am trying to understand how to map 2D to 3D using ggplot() and eventually plot_gg(). I am, however, stuck on understanding how to express the third variable to be mapped. This example: ggdiamonds = ggplot(diamonds, aes(x, depth)) + stat_density_2d(aes(fill = stat(nlevel)), geom = "polygon", n