View
A py3Dmol.view with helpers for geometries and arrows.
Usage
View()Methods
| Name | Description |
|---|---|
| add_geometry() | Add a geometry to the view. |
| add_vector() | Add an arrow. |
| add_vectors() | Add arrows that share a start point. |
| add_xyz_axes() | Add x, y, and z axis arrows from the origin. |
add_geometry()
Add a geometry to the view.
Usage
add_geometry(geo, *, label=False)Parameters
geo: Geometry-
Geometry.
label: bool = False-
If
True, label atoms by index.
add_vector()
Add an arrow.
Usage
add_vector(coord, start_coord=(0, 0, 0), *, direction=False, color="black")Parameters
coord: ArrayLike-
Arrow tip.
start_coord: ArrayLike = (0, 0, 0)-
Arrow start point.
direction: bool = False-
If
True, treatcoordas a direction fromstart_coordrather than an end point. color: str = "black"- Arrow color.
add_vectors()
Add arrows that share a start point.
Usage
add_vectors(coords, start_coord=(0, 0, 0), *, direction=False, colors=None)Parameters
coords: ArrayLike-
Arrow tips, one row per arrow.
start_coord: ArrayLike = (0, 0, 0)-
Start point shared by all arrows.
direction: bool = False-
If
True, treat each row ofcoordsas a direction fromstart_coordrather than an end point. colors: Sequence[str] | None = None- One color per arrow. Defaults to black.
Raises
ValueError- If the numbers of arrows and colors differ.
add_xyz_axes()
Add x, y, and z axis arrows from the origin.
Usage
add_xyz_axes(*, scale=1, colors=("red", "green", "blue"))Parameters
scale: float = 1-
Length of each arrow.
colors: tuple[str, str, str] = ("red", "green", "blue")- Colors of the x, y, and z arrows.