dncdd
2017-Apr-11 06:16 UTC
[R] how to plot three dimension data to filled contour plot or surface plot in R Ask Question
ENV? R?3.3.2 When?I?have?data?like: ????rdn<-c(0.8,1.8,2.8) ????tdn<-c(1,2,3,4,5,6,7,8,9) ???? ????idn<-matrix(c(0.3,?0.3,?0.3,?0.2,?0.2,?0.4,?0.1,?0.1,?0.5,?0,?0.2,?0.5,?0,?0.3,?0.6,?0,?0.4,?0.6,?0,?0.4,?0.6,?0,?0.5,?0.7,?0,?0.5,?0.7),?nrow=9,?ncol=3,?byrow=T) And?the?matrix?looks?like(3*9?=?27?data?elements): ????0.3,?0.3,?0.3,? ????0.2,?0.2,?0.4,? ????0.1,?0.1,?0.5,? ????0,?0.2,?0.5,? ????0,?0.3,?0.6,? ????0,?0.4,?0.6,? ????0,?0.4,?0.6,? ????0,?0.5,?0.7,? ????0,?0.5,?0.7 Then?I?can?get?a?filled.contour?with?parameters?x,y,z.?x?is?tdn,?y?is?rdn,?z?is?the?matrix.?I?already?get?this. ? **My?current?problem**?is: What?If?I?have?three?dimension?data ????r1dn<-c(0.8,1.8,2.8) ????r2dn<-c(0.8,1.8,2.8) ????tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) And?(3*3*9?=?81?data?elements): ?????0.8??????????????????1.8??????????????????2.8 ????0.8??1.8??2.8???????0.8??1.8??2.8????????0.8??1.8??2.8 ????---------------?81?----?elements?---------------------- ????0.3,?0.3,?0.3,??????0.3,?0.3,?0.5,???????0.3,?0.3,?0.3,? ????0.2,?0.2,?0.4,??????0.2,?0.4,?0.4,???????0.4,?0.2,?0.5, ????0.1,?0.1,?0.5,??????0.2,?0.3,?0.5,???????0.4,?0.4,?0.5,? ????0,?0.2,?0.5,????????0.2,?0.2,?0.6,???????0.4,?0.5,?0.6,? ????0,?0.3,?0.6,????????0.3,?0.3,?0.6,???????0.5,?0.5,?0.7,? ????0,?0.4,?0.6,????????0.2,?0.5,?0.7,???????0.5,?0.6,?0.7,? ????0,?0.4,?0.6,????????0,?0.5,?0.6,?????????0.5,?0.6,?0.9,?? ????0,?0.5,?0.7,????????0,?0.6,?0.8,?????????0.5,?0.7,?0.8,? ????0,?0.5,?0.7?????????0,?0.6,?0.8??????????0.5,?0.8,?0.9??????? I?googled?many?surface?and?contour?codes?but?I?still?not?find?some?code?for?three?dimension?data?yet.?How?to?do?that?in?R??Say,?x?is?r1dn,?y?is?r2dn,?z?is?tdn,?what?about?the?three?dimension?data??Does?ggplot?can?plot?three?dimension?filled?contour?or?surface?plot??Or?another?alternative?solutions? All?I?expected?is?a?3d?plot?with?color?changes?smoothly?and?no?grid?on?it. Looks?like: ? no?grid?for?next?three?figures ? ? ? Those?should?be?3d?filled?contour?or?3d?surface?plot. Thanks?for?your?time. ??[1]:?https://i.stack.imgur.com/z6u3p.png ??[2]:?https://i.stack.imgur.com/MEnFn.png ??[3]:?https://i.stack.imgur.com/Ri29w.png ??[4]:?https://i.stack.imgur.com/CdCqL.jpg ??[5]:?https://i.stack.imgur.com/Pt1Nw.jpg [[alternative HTML version deleted]]
Jeff Newmiller
2017-Apr-11 14:27 UTC
[R] how to plot three dimension data to filled contour plot or surface plot in R Ask Question
Ggplot does not do xyz. Look at package lattice or package rgl instead. -- Sent from my phone. Please excuse my brevity. On April 10, 2017 11:16:54 PM PDT, dncdd via R-help <r-help at r-project.org> wrote:>ENV? > >R?3.3.2 > >When?I?have?data?like: > >????rdn<-c(0.8,1.8,2.8) >????tdn<-c(1,2,3,4,5,6,7,8,9) >???? >????idn<-matrix(c(0.3,?0.3,?0.3,?0.2,?0.2,?0.4,?0.1,?0.1,?0.5,?0,?0.2,?0.5,?0,?0.3,?0.6,?0,?0.4,?0.6,?0,?0.4,?0.6,?0,?0.5,?0.7,?0,?0.5,?0.7),?nrow=9,?ncol=3,?byrow=T) > >And?the?matrix?looks?like(3*9?=?27?data?elements): > >????0.3,?0.3,?0.3,? >????0.2,?0.2,?0.4,? >????0.1,?0.1,?0.5,? >????0,?0.2,?0.5,? >????0,?0.3,?0.6,? >????0,?0.4,?0.6,? >????0,?0.4,?0.6,? >????0,?0.5,?0.7,? >????0,?0.5,?0.7 > >Then?I?can?get?a?filled.contour?with?parameters?x,y,z.?x?is?tdn,?y?is?rdn,?z?is?the?matrix.?I?already?get?this. > >? >**My?current?problem**?is: > >What?If?I?have?three?dimension?data > >????r1dn<-c(0.8,1.8,2.8) >????r2dn<-c(0.8,1.8,2.8) >????tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) > >And?(3*3*9?=?81?data?elements): > >?????0.8??????????????????1.8??????????????????2.8 >????0.8??1.8??2.8???????0.8??1.8??2.8????????0.8??1.8??2.8 > >????---------------?81?----?elements?---------------------- > >????0.3,?0.3,?0.3,??????0.3,?0.3,?0.5,???????0.3,?0.3,?0.3,? >????0.2,?0.2,?0.4,??????0.2,?0.4,?0.4,???????0.4,?0.2,?0.5, >????0.1,?0.1,?0.5,??????0.2,?0.3,?0.5,???????0.4,?0.4,?0.5,? >????0,?0.2,?0.5,????????0.2,?0.2,?0.6,???????0.4,?0.5,?0.6,? >????0,?0.3,?0.6,????????0.3,?0.3,?0.6,???????0.5,?0.5,?0.7,? >????0,?0.4,?0.6,????????0.2,?0.5,?0.7,???????0.5,?0.6,?0.7,? >????0,?0.4,?0.6,????????0,?0.5,?0.6,?????????0.5,?0.6,?0.9,?? >????0,?0.5,?0.7,????????0,?0.6,?0.8,?????????0.5,?0.7,?0.8,? >????0,?0.5,?0.7?????????0,?0.6,?0.8??????????0.5,?0.8,?0.9??????? > > >I?googled?many?surface?and?contour?codes?but?I?still?not?find?some?code?for?three?dimension?data?yet.?How?to?do?that?in?R??Say,?x?is?r1dn,?y?is?r2dn,?z?is?tdn,?what?about?the?three?dimension?data??Does?ggplot?can?plot?three?dimension?filled?contour?or?surface?plot??Or?another?alternative?solutions? > >All?I?expected?is?a?3d?plot?with?color?changes?smoothly?and?no?grid?on?it. > >Looks?like: > >? >no?grid?for?next?three?figures > >? >? >? >Those?should?be?3d?filled?contour?or?3d?surface?plot. > >Thanks?for?your?time. > > >??[1]:?https://i.stack.imgur.com/z6u3p.png >??[2]:?https://i.stack.imgur.com/MEnFn.png >??[3]:?https://i.stack.imgur.com/Ri29w.png >??[4]:?https://i.stack.imgur.com/CdCqL.jpg >??[5]:?https://i.stack.imgur.com/Pt1Nw.jpg > [[alternative HTML version deleted]] > >______________________________________________ >R-help at 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.
Ismail SEZEN
2017-Apr-11 16:48 UTC
[R] how to plot three dimension data to filled contour plot or surface plot in R Ask Question
After lon long search, my best shot was to use filled.contour + lattice::levelplot together [a] to represent 3 dimensional data on a flat surface. a) http://r.789695.n4.nabble.com/Creating-smooth-color-regions-with-panel-contourplot-td866253.html <http://r.789695.n4.nabble.com/Creating-smooth-color-regions-with-panel-contourplot-td866253.html> Some Details:> On 11 Apr 2017, at 09:16, dncdd via R-help <r-help at r-project.org> wrote: > > ENV > > R 3.3.2 > > When I have data like: > > rdn<-c(0.8,1.8,2.8) > tdn<-c(1,2,3,4,5,6,7,8,9) > > idn<-matrix(c(0.3, 0.3, 0.3, 0.2, 0.2, 0.4, 0.1, 0.1, 0.5, 0, 0.2, 0.5, 0, 0.3, 0.6, 0, 0.4, 0.6, 0, 0.4, 0.6, 0, 0.5, 0.7, 0, 0.5, 0.7), nrow=9, ncol=3, byrow=T) > > And the matrix looks like(3*9 = 27 data elements): > > 0.3, 0.3, 0.3, > 0.2, 0.2, 0.4, > 0.1, 0.1, 0.5, > 0, 0.2, 0.5, > 0, 0.3, 0.6, > 0, 0.4, 0.6, > 0, 0.4, 0.6, > 0, 0.5, 0.7, > 0, 0.5, 0.7 > > Then I can get a filled.contour with parameters x,y,z. x is tdn, y is rdn, z is the matrix. I already get this.If you have a rectangular data like matrix, you can use filled.contour (the best one) or rasterVis::levelplot.> > > **My current problem** is: > > What If I have three dimension data > > r1dn<-c(0.8,1.8,2.8) > r2dn<-c(0.8,1.8,2.8) > tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)At this point, you have to expand your data to x,y,z data pairs. I mean you have to reshaphe your data as a z value for each x and y point. data <- expand.grid(x = x, y = y) dta$z <- z Now, you have 3 columns + 9 rows data. You can use this data in lattice::levelplot by awesome formula interface.> > I googled many surface and contour codes but I still not find some code for three dimension data yet.Actually you found but they didn?t fill you requirements.> How to do that in R? Say, x is r1dn, y is r2dn, z is tdn, what about the three dimension data? Does ggplot can plot three dimension filled contour or surface plot? Or another alternative solutions?The problem here is, you want a filled/contour plot on a flat surface or 3D perspective visualisation? If you want 3D perspective visualisation, your only chances are rgl and misc3d packages. (as far as I know)> > All I expected is a 3d plot with color changes smoothly and no grid on it.All the solutions above may have (or not) smooth colour change and grid depending on your settings. What do you mean exactly "no grid on it?? If you choose that you don?t have a grid, then you don?t. You only need to search a bit more.> > Looks like: > no grid for next three figures > Those should be 3d filled contour or 3d surface plot. > Thanks for your time. > > [1]: https://i.stack.imgur.com/z6u3p.png > [2]: https://i.stack.imgur.com/MEnFn.png > [3]: https://i.stack.imgur.com/Ri29w.png > [4]: https://i.stack.imgur.com/CdCqL.jpg > [5]: https://i.stack.imgur.com/Pt1Nw.jpg > [[alternative HTML version deleted]][[alternative HTML version deleted]]
dncdd
2017-Apr-11 17:55 UTC
[R] 回复: how to plot three dimension data to filled contour plot or surface plot in R Ask Question
Thank you Ismail SEZEN.The link you give is filled.contour code which only works with my?first mini data?. The code in the link for R 3.3.2 is :****** code ***** in **** link **** for R 3.3.2 ****panel.filledcontour?<-?function(x,?y,?z,?subscripts,?at,?col.regions?=? cm.colors,? ????????????????????????????????col?=?col.regions(length(at)?-?1),?...)? {? ??stopifnot(require("gridBase"))? ??z?<-?matrix(z[subscripts],? ??????????????nrow?=?length(unique(x[subscripts])),? ??????????????ncol?=?length(unique(y[subscripts])))? ??if?(!is.double(z))?storage.mode(z)?<-?"double"? ??opar?<-?par(no.readonly?=?TRUE)? ??on.exit(par(opar))? ??if?(panel.number()?>?1)?par(new?=?TRUE)? ??par(fig?=?gridFIG(),?omi?=?c(0,?0,?0,?0),?mai?=?c(0,?0,?0,?0))? ??cpl?<-?current.panel.limits()? ??plot.window(xlim?=?cpl$xlim,?ylim?=?cpl$ylim,? ??????????????log?=?"",?xaxs?=?"i",?yaxs?=?"i")? ??#?paint?the?color?contour?regions? ??.filled.contour(as.double(do.breaks(cpl$xlim,?nrow(z)?-?1)),? ??????????????????????????as.double(do.breaks(cpl$ylim,?ncol(z)?-?1)),? ??????????????????????????z,?levels?=?as.double(at),?col?=?col) ??#?add?contour?lines? ??contour(as.double(do.breaks(cpl$xlim,?nrow(z)?-?1)),? ??????????as.double(do.breaks(cpl$ylim,?ncol(z)?-?1)),? ??????????z,?levels?=?as.double(at),?add=T,? ??????????col?=?"gray",?#?color?of?the?lines? ??????????drawlabels=F??#?add?labels?or?not? ?????????)? }? plot.new()? print(levelplot(volcano,?panel?=?panel.filledcontour,? ??????????col.regions?=?terrain.colors,? ??????????cuts?=?10,? ??????????plot.args?=?list(newpage?=?FALSE)))*** END ***?code *** in *** link *** for R 3.3.2 ***? first mini datawhich should be a three dimensinal data either and the data in matrix is not a function of rdn and tdnwhich means z matrix is not function of x,y.? ? ? rdn<-c(0.8,1.8,2.8) ????tdn<-c(1,2,3,4,5,6,7,8,9) ???? ????idn<-matrix(c(0.3,?0.3,?0.3,?0.2,?0.2,?0.4,?0.1,?0.1,?0.5,?0,?0.2,?0.5,?0,?0.3,?0.6,?0,?0.4,?0.6,?0,?0.4,?0.6,?0,?0.5,?0.7,?0,?0.5,?0.7),?nrow=9,?ncol=3,?byrow=T) And?the?matrix?looks?like(3*9?=?27?data?elements): ????0.3,?0.3,?0.3,? ????0.2,?0.2,?0.4,? ????0.1,?0.1,?0.5,? ????0,?0.2,?0.5,? ????0,?0.3,?0.6,? ????0,?0.4,?0.6,? ????0,?0.4,?0.6,? ????0,?0.5,?0.7,? ????0,?0.5,?0.7 Well, now I realized that?the second data?might (my current problem) be afour?dimensional data: r1dn<-c(0.8,1.8,2.8) r2dn<-c(0.8,1.8,2.8) tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) And?(3*3*9?=?81?data?elements): ? ? ?0.8??????????????????1.8??????????????????2.8 ? ? 0.8??1.8??2.8???????0.8??1.8??2.8????????0.8??1.8??2.8 ? ? ---------------?81?----?elements?------three matrix---------------- ? ? 0.3,?0.3,?0.3,??????0.3,?0.3,?0.5,???????0.3,?0.3,?0.3,? ? ? 0.2,?0.2,?0.4,??????0.2,?0.4,?0.4,???????0.4,?0.2,?0.5, ? ? 0.1,?0.1,?0.5,??????0.2,?0.3,?0.5,???????0.4,?0.4,?0.5,? ? ? 0,?0.2,?0.5,????????0.2,?0.2,?0.6,???????0.4,?0.5,?0.6,? ? ? 0,?0.3,?0.6,????????0.3,?0.3,?0.6,???????0.5,?0.5,?0.7,? ? ? 0,?0.4,?0.6,????????0.2,?0.5,?0.7,???????0.5,?0.6,?0.7,? ? ? 0,?0.4,?0.6,????????0,?0.5,?0.6,?????????0.5,?0.6,?0.9,?? ? ? 0,?0.5,?0.7,????????0,?0.6,?0.8,?????????0.5,?0.7,?0.8,? ? ? 0,?0.5,?0.7?????????0,?0.6,?0.8??????????0.5,?0.8,?0.9?? The three matrix is not the function of r1dn, r2dn, tdn. ?r1dn, r2dn, tdn can be labels. So there are four dimensional data. x is r1dn, y is r2dn, z is tdn and the three matrix is, let's say, vdn.Four dimension: r1dn r2dn tdn fdn as x,y,z,v. ?And v is not the function of x,y,z. So there are might need a 3d filled.contour. But I did not find it. All the code I found is that x,y,z and z is a function of x,y. Another situation I found is that x,y,z,v and v is function of x,y,z. But in my data, v is not a function of x,y,z. ------------------------------------------------------------------????Ismail SEZEN <sezenismail at gmail.com>?????2017?4?12?(???) 00:48????dncdd <dncdd at aliyun.com>????r-help <r-help at r-project.org>????Re: [R] how to plot three dimension data to filled contour plot or surface plot in R Ask Question After lon long search, my best shot was to use filled.contour + lattice::levelplot together [a] to represent 3 dimensional data on a flat surface.? a)?http://r.789695.n4.nabble.com/Creating-smooth-color-regions-with-panel-contourplot-td866253.html Some Details: On 11 Apr 2017, at 09:16, dncdd via R-help <r-help at r-project.org> wrote: ENV? R?3.3.2 When?I?have?data?like: ????rdn<-c(0.8,1.8,2.8) ????tdn<-c(1,2,3,4,5,6,7,8,9) ???? ????idn<-matrix(c(0.3,?0.3,?0.3,?0.2,?0.2,?0.4,?0.1,?0.1,?0.5,?0,?0.2,?0.5,?0,?0.3,?0.6,?0,?0.4,?0.6,?0,?0.4,?0.6,?0,?0.5,?0.7,?0,?0.5,?0.7),?nrow=9,?ncol=3,?byrow=T) And?the?matrix?looks?like(3*9?=?27?data?elements): ????0.3,?0.3,?0.3,? ????0.2,?0.2,?0.4,? ????0.1,?0.1,?0.5,? ????0,?0.2,?0.5,? ????0,?0.3,?0.6,? ????0,?0.4,?0.6,? ????0,?0.4,?0.6,? ????0,?0.5,?0.7,? ????0,?0.5,?0.7 Then?I?can?get?a?filled.contour?with?parameters?x,y,z.?x?is?tdn,?y?is?rdn,?z?is?the?matrix.?I?already?get?this. If you have a rectangular data like matrix, you can use filled.contour (the best one) or rasterVis::levelplot. ? **My?current?problem**?is: What?If?I?have?three?dimension?data ????r1dn<-c(0.8,1.8,2.8) ????r2dn<-c(0.8,1.8,2.8) ????tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) At this point, you have to expand your data to x,y,z data pairs. I mean you have to reshaphe your data as a z value for each x and y point.? data <- expand.grid(x = x, y = y)dta$z <- z? Now, you have 3 columns + 9 rows data. You can use this data in lattice::levelplot by awesome formula interface. I?googled?many?surface?and?contour?codes?but?I?still?not?find?some?code?for?three?dimension?data?yet.? Actually you found but they didn?t fill you requirements. How?to?do?that?in?R??Say,?x?is?r1dn,?y?is?r2dn,?z?is?tdn,?what?about?the?three?dimension?data??Does?ggplot?can?plot?three?dimension?filled?contour?or?surface?plot??Or?another?alternative?solutions? The problem here is, you want a filled/contour plot on a flat surface or 3D perspective visualisation? If you want 3D perspective visualisation, your only chances are rgl and misc3d packages. (as far as I know) All?I?expected?is?a?3d?plot?with?color?changes?smoothly?and?no?grid?on?it. All the solutions above may have (or not) smooth colour change and grid depending on your settings. What do you mean exactly "no grid on it?? If you choose that you don?t have a grid, then you don?t. You only need to search a bit more. Looks?like:? no?grid?for?next?three?figures Those?should?be?3d?filled?contour?or?3d?surface?plot. Thanks?for?your?time. ??[1]:?https://i.stack.imgur.com/z6u3p.png ??[2]:?https://i.stack.imgur.com/MEnFn.png ??[3]:?https://i.stack.imgur.com/Ri29w.png ??[4]:?https://i.stack.imgur.com/CdCqL.jpg ??[5]:?https://i.stack.imgur.com/Pt1Nw.jpg [[alternative HTML version deleted]] [[alternative HTML version deleted]]
Ismail SEZEN
2017-Apr-11 19:15 UTC
[R] how to plot three dimension data to filled contour plot or surface plot in R Ask Question
> On 11 Apr 2017, at 20:55, dncdd <dncdd at aliyun.com <mailto:dncdd at aliyun.com>> wrote: > > Thank you Ismail SEZEN. > The link you give is filled.contour code which only works with my first mini data .filled.contour + lattice::levelplot solution can handle either matrix or a 3 column (x,y,z) data.frame by using the formula z ~ x + y.> > The code in the link for R 3.3.2 is : > ****** code ***** in **** link **** for R 3.3.2 **** > panel.filledcontour <- function(x, y, z, subscripts, at, col.regions = > cm.colors, > col = col.regions(length(at) - 1), ...) > { > stopifnot(require("gridBase")) > z <- matrix(z[subscripts], > nrow = length(unique(x[subscripts])), > ncol = length(unique(y[subscripts]))) > if (!is.double(z)) storage.mode(z) <- "double" > opar <- par(no.readonly = TRUE) > on.exit(par(opar)) > if (panel.number() > 1) par(new = TRUE) > par(fig = gridFIG(), omi = c(0, 0, 0, 0), mai = c(0, 0, 0, 0)) > cpl <- current.panel.limits() > plot.window(xlim = cpl$xlim, ylim = cpl$ylim, > log = "", xaxs = "i", yaxs = "i") > # paint the color contour regions > .filled.contour(as.double(do.breaks(cpl$xlim, nrow(z) - 1)), > as.double(do.breaks(cpl$ylim, ncol(z) - 1)), > z, levels = as.double(at), col = col) > # add contour lines > contour(as.double(do.breaks(cpl$xlim, nrow(z) - 1)), > as.double(do.breaks(cpl$ylim, ncol(z) - 1)), > z, levels = as.double(at), add=T, > col = "gray", # color of the lines > drawlabels=F # add labels or not > ) > } > plot.new() > > print(levelplot(volcano, panel = panel.filledcontour, > col.regions = terrain.colors, > cuts = 10, > plot.args = list(newpage = FALSE))) > *** END *** code *** in *** link *** for R 3.3.2 *** > > first mini data > which should be a three dimensinal data either and the data in matrix is not a function of rdn and tdn > which means z matrix is not function of x,y.Here we are not interested in z is function of x and y but at the and, if you want to plot a 3D data on a flat surface, you need x and y for each z in the 3D space.> > rdn<-c(0.8,1.8,2.8) > tdn<-c(1,2,3,4,5,6,7,8,9) > > idn<-matrix(c(0.3, 0.3, 0.3, 0.2, 0.2, 0.4, 0.1, 0.1, 0.5, 0, 0.2, 0.5, 0, 0.3, 0.6, 0, 0.4, 0.6, 0, 0.4, 0.6, 0, 0.5, 0.7, 0, 0.5, 0.7), nrow=9, ncol=3, byrow=T) > > And the matrix looks like(3*9 = 27 data elements): > > 0.3, 0.3, 0.3, > 0.2, 0.2, 0.4, > 0.1, 0.1, 0.5, > 0, 0.2, 0.5, > 0, 0.3, 0.6, > 0, 0.4, 0.6, > 0, 0.4, 0.6, > 0, 0.5, 0.7, > 0, 0.5, 0.7As I mentioned above, you have z values for each x and y values in the space. one of elements of z might be NA/NaN but at last you have.> > > Well, now I realized that the second data might (my current problem) be afour dimensional data: > > r1dn<-c(0.8,1.8,2.8) > r2dn<-c(0.8,1.8,2.8) > tdn<-c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)Thing are changed now. We are living in a 4D space (at least that we can sense) and there are only 2 ways to visualize 4D data on a flat surface. These are your only chance. 1- 3D perspective plotting (one of rgl, misc3d, scatterplot3d). Plot 'points' in the 3D space and set 4th dimension as color for each point. Does it make sense? I don?t know, it?s up to you. 2- for the (x,y,z,v) dimensions, plot contours of (x,y,v) for each z. I mean, assume z is height, slice it and plot each slice by filled.contour/levelplot or what ever you want.> > And (3*3*9 = 81 data elements): > > 0.8 1.8 2.8 > 0.8 1.8 2.8 0.8 1.8 2.8 0.8 1.8 2.8 > > --------------- 81 ---- elements ------three matrix---------------- > > 0.3, 0.3, 0.3, 0.3, 0.3, 0.5, 0.3, 0.3, 0.3, > 0.2, 0.2, 0.4, 0.2, 0.4, 0.4, 0.4, 0.2, 0.5, > 0.1, 0.1, 0.5, 0.2, 0.3, 0.5, 0.4, 0.4, 0.5, > 0, 0.2, 0.5, 0.2, 0.2, 0.6, 0.4, 0.5, 0.6, > 0, 0.3, 0.6, 0.3, 0.3, 0.6, 0.5, 0.5, 0.7, > 0, 0.4, 0.6, 0.2, 0.5, 0.7, 0.5, 0.6, 0.7, > 0, 0.4, 0.6, 0, 0.5, 0.6, 0.5, 0.6, 0.9, > 0, 0.5, 0.7, 0, 0.6, 0.8, 0.5, 0.7, 0.8, > 0, 0.5, 0.7 0, 0.6, 0.8 0.5, 0.8, 0.9 > > The three matrix is not the function of r1dn, r2dn, tdn. r1dn, r2dn, tdn can be labels. So there are four dimensional data. x is r1dn, y is r2dn, z is tdn and the three matrix is, let's say, vdn. > Four dimension: r1dn r2dn tdn fdn as x,y,z,v. And v is not the function of x,y,z. So there are might need a 3d filled.contour. But I did not find it. All the code I found is that x,y,z and z is a function of x,y. Another situation I found is that x,y,z,v and v is function of x,y,z. But in my data, v is not a function of x,y,z.Actually, you need to detail (in your mind and to us) what do you mean by being function of. A point can be represented by 4 points in 4D space (x,y,z,t). According to this; v is short for value (measurement); v(x,y,z,t) can represent a value in space and time. So this is a 5D data I assume. We mostly use one or 2 or 3 of this dimensions. So, v is function of (x, y, z, t) and change by (x, y, z, t). For instance, if v is not function of time (t), it is always constant and does not change in time. Hence, I dont need 4th dimension (t here) and I don?t need to plot v in a 4D space. This is what I know about being function of. [[alternative HTML version deleted]]