plot3D()
One of the core functionalities of
protein8k is the ability to plot a 3 dimensional model of a protein’s
atomic record. This vignette serves to explore the function that enables
this capability, plot3D()
. This function is primarily a
wrapper function of the lattice cloud()
function, thus much
of the functionality of this function should feel familiar to those with
experience in lattice.
Creating a simple plot is very easy. The following code creates a simple plot looking at what could be considered the “front” of the protein.
This visual is not very aesthetically pleasing, nor does it provide
any insight. The next few sections will demonstrate how to use the
various arguments in plot3D()
to make insightful 3D
visualizations of a protein’s atomic record.
One of the quickest ways to gain additional insight into a protein’s structure is to animate a plot of it spinning on an axis. When animating the plot, the function will create a series of PNG images looking at the plot from different angles before combining them into a single GIF and plotting to the viewer.
Now that the protein is spinning about an axis you can more clearly see the structures that it is made of.
A simple cloud of points or crosses is not always very insightful.
Fortunately, plot3D()
has a number of options including
points, lines, and histograms. The histogram is special becuase for
every point it will draw a line to a face on the XY plane, either the
lower or upper bound depending on which is closer. It is also poossible
to specify both lines and points. To change the drawing type, set the
type
argument to one of the following:
Often to gain better insight into how a protein is constructed one
requires colors to be applied based on some grouping variable. This is
easily done with plot3D()
. Set the groups argument to any
one of the columns found in the atomic record of the Protein object.
At this point in the development. legends are not supported.
Another part of the visualization that can be changed is the screen argument This argument is a list of transformations that rotate the visualization. Each rotation is specified on the X, Y, or Z axis, in some number of degrees. The rotations are performed in the order they are listed, and rotations on the same axis can be repeated.
For example, here is a single transformation of the same scale on each axis:
Generally it is recommended that when rotating the plot for a better angle, begin with the z axis to rotate around, then angle up or down with the x axis. This will keep the plot more readable and reduce confusion regarding the orientation of the plot. Generally transformations on the y are not necessary.
Also, keep in mind that the screen argument will not have any effect
when animated = TRUE
.