swplot package#
The package contains functions that can create and control plotting of 3D
objects. It contains low level functions to plot specific shapes on any
figure (cylinder, line, arrow, ellipsoid, polyhedron, sphere, text) that
are vectorized for fast plotting of multiple objects using a single
[matlab:patch] command. Moreover it provides the swplot.plot command to
plot multiple objects with specific color, transparency, label and legend
on the swplot figure including tha ability for smooth rotation and
translations via the mouse (that are much better than the default 3D
rotation with mouse in Matlab). Moreover it has high level commands to
plot crystals from SpinW objects (swplot.plot... commands).
Files#
Basic 3D objects#
Plots primitive geometrical shapes, able to plot multiple objects when input is vectorized. Can give considerable speedup because a single patch command is used to plot multiple shapes.
swplot.arrow creates a 3D arrow patch
swplot.circle creates a 3D circle surface patch
swplot.cylinder creates a closed/open 3D cylinder patch
swplot.ellipsoid creates a 3D ellipsoid patch
swplot.line creates 3D line patch
swplot.polyhedron creates convex polyhedra or polygon from vertex list
swplot.text creates text at a 3D position
Creating and modifying swplot figure#
These functions provide complete control over the transformations, objects on an swplot figure. These are the alternatives to the Matlab built in commands that control 3D plot axes. The advantage here is the smooth mouse rotation/zoom functionality, nice legend and ability to assign a tooltip text to any object that is triggered by a mouse click on the object.
swplot.activefigure returns the handle of the active swplot figure
swplot.add adds a graphical object to an swplot figure
swplot.base sets the basis vectors of an swplot figure
swplot.clear clears swplot figure
swplot.close closes swplot figure
swplot.delete deletes objects and corresponding data from swplot figure
swplot.export exports swplot figure into raster/vector image
swplot.figure creates swplot figure
swplot.findobj finds object data on swplot figure
swplot.getdata gets the data stored in an swplot figure
swplot.legend adds legend to the swplot figure
swplot.mouse adds mouse callbacks to swplot figure
swplot.plot plots objects to swplot figure
swplot.tooltip creates tooltip
swplot.transform transforms objects on swplot figure
swplot.translate translates objects on swplot figure
swplot.view controls the 3D view direction
swplot.zoom zooms to objects
Plotting SpinW object on swplot figure#
These high level plot commands are used to plot different types of data that is stored in the spinw object. All inputs of these commands can be controlled from the spinw.plot command.
swplot.plotatom plots crystal structure
swplot.plotbase plots basis vectors
swplot.plotbond plots bonds
swplot.plotcell plots unit cell
swplot.plotchem plots polyhedra or chemical bonds
swplot.plotion plots magnetic ion properties
swplot.plotmag plots magnetic structure