StructurePlotter
Bases: VtkPlotter
A convenience class for creating plots of crystal structures using pyvista's package for VTK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
Structure
|
The pymatgen Structure object to plot. |
required |
Source code in src/baderkit/plotting/toolkit/structure.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
atom_colors
property
writable
¶
Returns:
| Type | Description |
|---|---|
list[str]
|
The atom_colors to use for each atom as hex codes. |
atom_df
property
writable
¶
Returns:
| Name | Type | Description |
|---|---|---|
atom_df |
TYPE
|
A dataframe summarizing the properties of the atom meshes. |
atom_metallicness
property
writable
¶
Returns:
| Type | Description |
|---|---|
float
|
The amount of metallic character in the atom display. |
atom_opacities
property
writable
¶
Returns:
| Type | Description |
|---|---|
NDArray[float]
|
Whether or not each atom is visible. This is actually the opacity if desired. |
atom_radii
property
writable
¶
Returns:
| Type | Description |
|---|---|
NDArray[float]
|
The radius to display for each atom in the structure. The actual displayed radius will be radii_scale*radius. |
atom_roughness
property
writable
¶
Returns:
| Type | Description |
|---|---|
float
|
The amount of roughness in the atom display. |
background_color
property
writable
¶
Returns:
| Type | Description |
|---|---|
str
|
The color of the plot background as a hex code, rgb array, or color string. |
lattice_thickness
property
writable
¶
Returns:
| Type | Description |
|---|---|
float
|
The thickness of the lines outlining the unit cell. |
light_color
property
writable
¶
Returns:
| Type | Description |
|---|---|
str
|
The color of the light shining on the scene as a hex code, rgb array, or color string. |
light_intensity
property
writable
¶
Returns:
| Type | Description |
|---|---|
str
|
The intensity of the light on the scene from 0-1 |
parallel_projection
property
writable
¶
Returns:
| Type | Description |
|---|---|
bool
|
If True, a parallel projection scheme will be used rather than perspective. |
pbr
property
writable
¶
Returns:
| Type | Description |
|---|---|
bool
|
If True, physically based rendering will be used |
radii_scale
property
writable
¶
Returns:
| Type | Description |
|---|---|
float
|
A constant to multiply atom radii by |
show_axes
property
writable
¶
Returns:
| Type | Description |
|---|---|
bool
|
Whether or not to show the axis widget. |
show_lattice
property
writable
¶
Returns:
| Type | Description |
|---|---|
bool
|
Whether or not to display the outline of the unit cell. |
get_plot_html()
¶
Creates an html string representing the current state of the StructurePlotter class.
Returns:
| Type | Description |
|---|---|
str
|
The html string representing the current StructurePlotter class. |
Source code in src/baderkit/plotting/base/base.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
get_plot_screenshot(filename=None, transparent_background=None, return_img=True, window_size=None, scale=None)
¶
Creates a screenshot of the current state of the StructurePlotter class. This is a wraparound of pyvista's screenshot method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str | Path | BytesIO
|
Location to write image to. If None, no image is written. |
None
|
transparent_background
|
bool
|
Whether to make the background transparent. The default is looked up on the plotter’s theme. |
None
|
return_img
|
bool
|
If True, a numpy.ndarray of the image will be returned. Defaults to True. |
True
|
window_size
|
tuple[int, int]
|
Set the plotter’s size to this (width, height) before taking the screenshot. |
None
|
scale
|
int
|
Set the factor to scale the window size to make a higher resolution image. If None this will use the image_scale property on this plotter which defaults to one. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float]
|
Array containing pixel RGB and alpha. Sized: [Window height x Window width x 3] if transparent_background is set to False. [Window height x Window width x 4] if transparent_background is set to True. |
Source code in src/baderkit/plotting/base/base.py
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | |
rebuild()
¶
Builds a new pyvista plotter object representing the current state of the Plotter class.
Returns:
| Type | Description |
|---|---|
Plotter
|
A pyvista Plotter object representing the current state of the StructurePlotter class. |
Source code in src/baderkit/plotting/base/base.py
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | |
show()
¶
Renders the plot to a window. After closing the window, a new instance must be created to plot again. Pressing q pauses the rendering allowing changes to be made without fully exiting.
Returns:
| Type | Description |
|---|---|
None.
|
|
Source code in src/baderkit/plotting/base/base.py
601 602 603 604 605 606 607 608 609 610 611 612 613 | |
soft_rebuild()
¶
reuilds the current pyvista plotter object with current settings.
Returns:
| Type | Description |
|---|---|
Plotter
|
A pyvista Plotter object representing the current state of the StructurePlotter class. |
Source code in src/baderkit/plotting/base/base.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |