Minimum Curvature Gridding in R or QGIS? - r

I'm looking for a way to grid oceanographic spatial data using Minimum Curvature. It can be done in Surfer, but i'm look for OpenSource methods. Have looked in R and QGIS but no joy. Perhaps is buried in an R package somewhere? Can't see it in the 'spatial' package. Had no luck finding in GRASS either. Any ideas?
Thanks,
PB

How about Tps from the fields package? It fits thin plate splines which might be equivalent to minimum curvature...

Look at surfit - result is comparable with MINC. I can say more - the only difference is that MINC have special condition on the grid boundary, instead of surfit.

Related

Predicting Pixel Intensity Based on Surrounding Pixels

I am trying to build a model that will try to predict the pixel intensity at a particular point based off of the surrounding pixel intensities. As of now, the only way that I can think of doing this is averaging out the points, but I really don't think this is the best option. Someone suggested I try to use auto-regressive models, ARIMA I think, but I am not very familiar with the program. Would this be an appropriate program to use for what I need, if not, does anyone have any other suggestions for what I could use to do this in R?
Have a look at the spatstat package: http://spatstat.github.io.
From the FAQ, it supports using pixel image as data.
You should then be able to run spatial autoregression using the spdep package https://cran.r-project.org/web/packages/spdep/index.html, in particular the lagsarlm function.

Plot 3D graphs in R-studio

Sorry for the question, but I have a variable that I would like to plot like this:
I am a newby on R, so I am having some difficulties. I appreciate any kind of help.
Thanks!
Since you're looking to plot what appears to be a 3d surface, I'd suggest starting with the persp function, from the graphics package. This blog post (http://www.r-bloggers.com/3d-plots-in-r/) gives a good treatment of several options for 3D plotting:
the generic function persp() in the base graphics package draws perspective plots of a surface over the x–y plane. Typing demo(persp) at the console will give you an idea of what this function can do.
And running demo(persp) gives you a number of examples, including this one:
There are also some more suggestions for going further:
The plot3D package from Karline Soetaert builds on on persp()to provide functions for both 2D and 3D plotting. [...] Load the package and type the following commands at the console: example(persp3D), example(surf3D) and example(scatter3D) to see examples of 3D surface and scatter plots.
As a side note, #rawr's comment is spot on - I found all this in less than a minute, using two google searches - one of which was the title of your post. I'm putting this answer up anyway, since StackOverflow posts frequently become the top google result for many topics. But the best advice I can give you going forward is that R is one of the most aggressively well-documented languages out there, both in terms of formal and informal documentation, and you can find a lot just by googling what you want to do.

plotting voxel image in R

Do you know if it exist libraries or functions in R to plot voxel objects (3D array)?
I found the package rgl that can perform 3d scatter plot, but I am really looking for an equivalent of the function "image" that works with 3D array.
Thanks
Here is a basic example of something using the rgl package. You can easily make it into a function that operates on a 3D array to alter the colour, alpha or other features of interest.
library(rgl)
cubit=cube3d(color="blue", alpha=0.3)
cubit$vb[cubit$vb == -1]= 0
gridx=0:5;gridy=0:5;gridz=0:5
temp=cubit
plot3d(temp,box=FALSE,axes=FALSE,xlab="",ylab="",zlab="")
wire3d(temp,add=TRUE,color="blue",alpha=1)
for(ix in gridx){
for(iy in gridy){
for(iz in gridz){
temp$vb[1,]=cubit$vb[1,]+ix
temp$vb[2,]=cubit$vb[2,]+iy
temp$vb[3,]=cubit$vb[3,]+iz
shade3d(temp,add=TRUE,,alpha=runif(1))
wire3d(temp,add=TRUE,color="blue")
}
}
}
I have used something like this, but I have noted that the memory size grows very quickly (I cannot do more than 60000 voxels, using 3-4Gb RAM). I have tried something similar using cube3D from the plot3D package thinking that a non-interactive plot would (should!) be more memory efficient, but for some reason this package had worse performance (only 1000 voxels). If you have a solid cube, then you can be much smarter about only plotting the outer edges using a ploygon3D plot ... but that is not my case. I am still searching for better performance using R functionality, but thought I should add to this conversation in case of any other wandering souls who cross paths here too.

Plotting large numbers with R, but not all numbers are being shown

I am trying to render 739455 data point on a graph using R, but on the x-axis I can not view all those numbers, is there a way I can do that?
I am new to R.
Thank you
As others suggested, try hist, hexbin, plot(density(node)), as these are standard methods for dealing with more points than pixels. (I like to set hist with the parameter breaks = "FD" - it tends to have better breakpoints than the default setting.)
Where you may find some joy is in using the iplots package, an interactive plotting package. The corresponding commands include ihist, iplot, and more. As you have a Mac, the more recent Acinonyx package may be even more fun. You can zoom in and out quite easily. I recommend starting with the iplots package as it has more documentation and a nice site.
If you have a data frame with several variables, not just node, then being able to link the different plots such that brushing points in one plot highlights them in another will make the whole process more stimulating and efficient.
That's not to say that you should ignore hexbin and the other ideas - those are still very useful. Be sure to check out the options for hexbin, e.g. ?hexbin.

How to plot a set of densities in 3D using R?

I need to plot, in 3D, a set of densities associated to a time series. More precisely, I would like to be able in R to build an image close to this example
This image is taken from [1]. The transparency plays an important role as let us see the trajectory of the "measures" in the x-y plane.
Any help will be greatly appreciated.
[1]: Juban and Kariniotakis, "Uncertainty Estimation of Wind Power Forecasts", presentation at EWEC 2008 - 01 April - Brussels, Belgium. (I can't post the link, google will help interested readers).
In 1996 I wrote a paper (published in JCGS) with a figure very similar to that but without the transparency. See http://robjhyndman.com/papers/estimating-and-visualizing-conditional-densities/ for the details. The plotting function is implemented in the R package hdrcde available on CRAN. The package contains some examples in the help files. You should be able to adapt my code to add the transparency.
This is how far I got thanks to Rob's hint. I used persp() to create an empty plot and added polygons and lines to it:
However, it is not as pretty as the original one... :(

Resources