2D Energy Surface plot example?
Hi,
Does anyone have an example on how to plot an Energy Surface, provided a plain-text file with 3 columns (i.e. PCA 1, PCA2 and Free Energy?)
Comments (3)
-
-
Certainly start with Xin-Qiu's example above but I do also encourage you to explore the many, many other options that are available for these types of plots.
For example, check out Karline Soetaert's plot3D package vignette, "50 ways to plot a volcano" < http://cran.r-project.org/web/packages/plot3D/vignettes/volcano.pdf >.
Also look at < http://rgm3.lab.nig.ac.jp/RGM/R_image_list > and search for 'plot3d'. These two were mentioned in a stakoverflow post that replicated a MatLab like surface plot: < http://stackoverflow.com/questions/20549540/how-to-create-3d-matlab-style-surface-plots-in-r >
Here is another example from plot3D... (see attached)...
# Composite image using functions within the plot3D package (note. will be slow to render) install.packages("plot3D") library(plot3D) persp3D(z = volcano, zlim = c(-60, 200), phi = 20, colkey = list(length = 0.2, width = 0.4, shift = 0.15, cex.axis = 0.8, cex.clab = 0.85), lighting = TRUE, lphi = 90, clab = c("","height","m"), bty = "f", plot = FALSE) # create gradient in x-direction Vx <- volcano[-1, ] - volcano[-nrow(volcano), ] # add as image with own color key, at bottom image3D(z = -60, colvar = Vx/10, add = TRUE, colkey = list(length = 0.2, width = 0.4, shift = -0.15, cex.axis = 0.8, cex.clab = 0.85), clab = c("","gradient","m/m"), plot = FALSE) # add contour contour3D(z = -60+0.01, colvar = Vx/10, add = TRUE, col = "black", plot = TRUE)
-
- changed status to resolved
- Log in to comment
Hi,
We don't have function to specifically deal with free energy data yet (although it is on the To-do list). But I think it is not very difficult if you check out a little bit the contourplot() function in the lattice package. Note that contourplot() takes a 2-D matrix as input, and so you have to convert your data first. For example,
Type help(contourplot) to find more options to customize your plot.