[R] can we visualize water flows with 3d in R?
Duncan Mackay
dulcalma at bigpond.com
Fri Oct 14 10:13:06 CEST 2016
Hi Marna
These are a few suggestions for EDA of your data
Firstly check it – it is laborious work but it needs to be done – use a proper database if R is not suitable (memory,time)
dat <- read.csv("G:/1/example_subsetdata.csv")
dat <- subset(dat, !is.na(depth))
apply(dat,2,range,na.rm=T)
table(cut(dat$depth, breaks = seq(496.5, 498.5, 0.25), include.lowest = TRUE, labels = F)) # needs more groups to even out numbers
# use hand drafted breaks
table(dat$Y)
dat$ldepth <- cut(dat$depth, breaks = seq(496.5, 498.5, 0.25), include.lowest = TRUE, labels = F)
xyplot(Y ~ X|factor(ldepth), subset(dat, Y > 400), pch = ".", as.table = TRUE)
xyplot(flow ~ X|factor(ldepth), subset(dat, Y > 400), pch = ".", as.table = TRUE, col =1)
xyplot(flow ~ Y|factor(ldepth), subset(dat, Y > 400), pch = ".", as.table = TRUE, col =1)
I have made pch = ‘.’ so that points are not overtopping. increase by by units ie cex = 2 , cex =3 if you want to make them larger
Have a look a lattice::par.settings and names(trellis.par.get()) these will make things easier if you you are using panel functions.
I did not go further but the next step in this would be lattice 3d plots contourplot wireframe etc.
You will get more information in working with the full dataset
I have not really gone into spatials but you should look at the task view on spatial analysis.
and the spatial SIG
How you proceed will be partly determined by your future requirements of which I am not qualified.
Regards
Duncan
From: Marna Wagley [mailto:marna.wagley at gmail.com]
Sent: Friday, 14 October 2016 03:13
To: Duncan Mackay
Subject: Re: [R] can we visualize water flows with 3d in R?
Hi Duncan,
Thank you very much for the message. Indeed I do have a very big data set with a grid size of 10cm * 10 cm. Every 10 cm*10cm grid has the value of X,Y, depth and flow measurement. I have attached a subset of the data.
Thanks
On Wed, Oct 12, 2016 at 11:05 PM, Duncan Mackay <dulcalma at bigpond.com> wrote:
Hi
With a small data set 3D is not really an option; reduce the number of
dimensions-- 2D conditional
library(lattice)
xyplot(flow ~ depth|factor(long), dat1, groups = lat, type = c("p","r"), pch
= 16)
I had started with lat and long reversed doing EDA gave the above
? latitude effect
Regards
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Marna Wagley
Sent: Wednesday, 12 October 2016 19:49
To: r-help mailing list
Subject: [R] can we visualize water flows with 3d in R?
Hi R Users,
Is it possible to visualize river flow in 3D (latitude, longitude with
respect to depth)?
The example of my data looks like. Any suggestions?
> dat1
long lat depth flow
1 1015.9 857 1.00 1.50
2 1015.9 857 1.25 1.23
3 1015.9 857 0.50 2.00
4 1015.9 858 0.10 1.95
5 1015.9 858 0.20 1.50
6 1025.0 858 0.30 1.20
7 1025.0 858 0.40 0.50
8 1025.0 858 0.35 0.70
9 1025.0 858 0.24 1.20
Thanks for your help.
thanks
[[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.
______________________________________________
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.
[[alternative HTML version deleted]]
More information about the R-help
mailing list