Widgets And Objects For 3D Plots#
All functions for creating 3D plots can also be done through a SubplotWidget3D object. This is useful for 3D subplots,
or just if you prefer working with widgets and not having to write _3D after all your functions.
squap.make_3D() can be used to initialse a SubplotWidget3D object, or turn an existing
plot object from squap.subplots() into a 3D plot.
- class squap.widgets.plot_widget_3D.SubplotWidget3D(row, col, **kwargs)[source]#
Widget for 3D plots. Obtain from
squap.make_3D()- set_camera(
- x_offset=None,
- y_offset=None,
- z_offset=None,
- distance=None,
- azimuth=None,
- elevation=None,
- fov=None,
Sets the camera offset, distance, rotation and fov using the given arguments.
distance,azimuthandelevationact like polar coordinates around the origin, andx_offset,y_offsetandz_offsetdetermine the position of this origin. Usesquap.align_camera()to experiment with these values and find the correct ones.- Parameters:
x_offset (float, optional) – New x offset of the origin.
y_offset (float, optional) – New y offset of the origin.
z_offset (float, optional) – New z offset of the origin.
distance (float, optional) – New distance between the camera position and the origin.
azimuth (float, optional) – Angle of rotation horizontally around the origin.
elevation (float, optional) – Angle of rotation vertically about the origin.
fov (float, optional) – Field of view.
- scatter(
- x=None,
- y=None,
- z=None,
- pos=None,
- color='y',
- size=4,
- pixel_mode=True,
- **kwargs,
Creates a new scatter plot item. Use either
x,yandzorposto set the coordinates of the points.- Parameters:
x (
np.ndarray, optional) – New x-locations of each point. Defaults toNone, which means the data will be initialised withpos, or it will be initialised later.y (
np.ndarray, optional) – New y-locations of each point. Defaults toNone, which means the data will be initialised withpos, or it will be initialised later.z (
np.ndarray, optional) – New z-locations of each point. Defaults toNone, which means the data will be initialised withpos, or it will be initialised later.pos (
np.ndarray, optional) – Shape(N, 3)(array) of floats specifying point locations. Can be used instead ofx,yandz.color (ColorsType) – Changes the color of the points. See ColorsType for allowed values.
size (int or list of int) – The size of the scatter plot points. Also accepted as
s. Default is4.pixel_mode (bool) – Whether to fix the size of each point. If
True, size is specified in pixels. IfFalse, size is specified in data coordinates. Defaults toTrue.
- set_zoom_rate(
- new_rate=1.003,
Sets the rate at which you zoom when the plot is zoomed after it has been created. Starts off at
1.003.
- add_grid(
- diagonal,
- spacing=1,
Adds a grid that lies on or parallel to one of the planes.
- Parameters:
- Returns:
The created grid.
- Return type:
- add_grids(
- size,
- spacing=1,
Adds square grids on the xy, yz and zx planes, spanning from
size[0]tosize[1].- Parameters:
- Returns:
The created grids.
- Return type:
list of
GLGridItem