GSP Matplotlib API Reference¶
The GSP Matplotlib backend provides rendering using the Matplotlib library, enabling integration with the Python scientific visualization ecosystem.
Overview¶
gsp_matplotlib
¶
GSP Matplotlib package initialization.
Renderer Module¶
The renderer module contains the main Matplotlib renderer implementation and specialized renderers for different visual types.
gsp_matplotlib.renderer
¶
Matplotlib Renderer Package.
MatplotlibRenderer
¶
Bases: gsp.types.renderer_base.RendererBase
Matplotlib-based renderer for GSP visuals.
This renderer implements the GSP rendering interface using Matplotlib as the backend. It creates and manages a Matplotlib figure with multiple axes for different viewports, and renders various visual types (pixels, points, paths, markers, segments, texts) into them.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
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 | |
__init__(canvas: Canvas)
¶
Initialize the Matplotlib renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
canvas
|
gsp.core.canvas.Canvas
|
The canvas defining the rendering surface dimensions and DPI. |
required |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
get_canvas() -> Canvas
¶
Get the canvas associated with this renderer.
Returns:
| Type | Description |
|---|---|
gsp.core.canvas.Canvas
|
The canvas instance. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
64 65 66 67 68 69 70 | |
close() -> None
¶
Close the renderer and release resources.
Stops the Matplotlib event loop and closes the figure.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
72 73 74 75 76 77 78 79 80 81 82 | |
show() -> None
¶
Display the rendered figure in an interactive window.
This method shows the Matplotlib figure. It does nothing when running in test mode (GSP_TEST environment variable set to "True").
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
render(viewports: Sequence[Viewport], visuals: Sequence[VisualBase], model_matrices: Sequence[TransBuf], cameras: Sequence[Camera], return_image: bool = True, image_format: str = 'png') -> bytes
¶
Render the scene to an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viewports
|
typing.Sequence[gsp.core.viewport.Viewport]
|
Sequence of viewport regions to render into. |
required |
visuals
|
typing.Sequence[gsp.types.visual_base.VisualBase]
|
Sequence of visual elements to render. |
required |
model_matrices
|
typing.Sequence[gsp.types.transbuf.TransBuf]
|
Sequence of model transformation matrices for each visual. |
required |
cameras
|
typing.Sequence[gsp.core.camera.Camera]
|
Sequence of cameras defining view and projection for each visual. |
required |
return_image
|
bool
|
Whether to return the rendered image as bytes. |
True
|
image_format
|
str
|
Format for the output image (e.g., "png", "jpg"). |
'png'
|
Returns:
| Type | Description |
|---|---|
bytes
|
The rendered image as bytes in the specified format, or empty bytes if return_image is False. |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If the sequences don't all have the same length. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
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 | |
get_mpl_axes_for_viewport(viewport: Viewport) -> matplotlib.axes.Axes
¶
Get the Matplotlib axes associated with a viewport.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viewport
|
gsp.core.viewport.Viewport
|
The viewport to get axes for. |
required |
Returns:
| Type | Description |
|---|---|
matplotlib.axes.Axes
|
The Matplotlib Axes object for the given viewport. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
210 211 212 213 214 215 216 217 218 219 | |
get_mpl_figure() -> matplotlib.figure.Figure
¶
Get the underlying Matplotlib figure.
Returns:
| Type | Description |
|---|---|
matplotlib.figure.Figure
|
The Matplotlib Figure object used by this renderer. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
221 222 223 224 225 226 227 | |
Matplotlib Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer
¶
Matplotlib renderer for GSP visuals.
MatplotlibRenderer
¶
Bases: gsp.types.renderer_base.RendererBase
Matplotlib-based renderer for GSP visuals.
This renderer implements the GSP rendering interface using Matplotlib as the backend. It creates and manages a Matplotlib figure with multiple axes for different viewports, and renders various visual types (pixels, points, paths, markers, segments, texts) into them.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
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 | |
__init__(canvas: Canvas)
¶
Initialize the Matplotlib renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
canvas
|
gsp.core.canvas.Canvas
|
The canvas defining the rendering surface dimensions and DPI. |
required |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
close() -> None
¶
Close the renderer and release resources.
Stops the Matplotlib event loop and closes the figure.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
72 73 74 75 76 77 78 79 80 81 82 | |
get_canvas() -> Canvas
¶
Get the canvas associated with this renderer.
Returns:
| Type | Description |
|---|---|
gsp.core.canvas.Canvas
|
The canvas instance. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
64 65 66 67 68 69 70 | |
get_mpl_axes_for_viewport(viewport: Viewport) -> matplotlib.axes.Axes
¶
Get the Matplotlib axes associated with a viewport.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viewport
|
gsp.core.viewport.Viewport
|
The viewport to get axes for. |
required |
Returns:
| Type | Description |
|---|---|
matplotlib.axes.Axes
|
The Matplotlib Axes object for the given viewport. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
210 211 212 213 214 215 216 217 218 219 | |
get_mpl_figure() -> matplotlib.figure.Figure
¶
Get the underlying Matplotlib figure.
Returns:
| Type | Description |
|---|---|
matplotlib.figure.Figure
|
The Matplotlib Figure object used by this renderer. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
221 222 223 224 225 226 227 | |
render(viewports: Sequence[Viewport], visuals: Sequence[VisualBase], model_matrices: Sequence[TransBuf], cameras: Sequence[Camera], return_image: bool = True, image_format: str = 'png') -> bytes
¶
Render the scene to an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viewports
|
typing.Sequence[gsp.core.viewport.Viewport]
|
Sequence of viewport regions to render into. |
required |
visuals
|
typing.Sequence[gsp.types.visual_base.VisualBase]
|
Sequence of visual elements to render. |
required |
model_matrices
|
typing.Sequence[gsp.types.transbuf.TransBuf]
|
Sequence of model transformation matrices for each visual. |
required |
cameras
|
typing.Sequence[gsp.core.camera.Camera]
|
Sequence of cameras defining view and projection for each visual. |
required |
return_image
|
bool
|
Whether to return the rendered image as bytes. |
True
|
image_format
|
str
|
Format for the output image (e.g., "png", "jpg"). |
'png'
|
Returns:
| Type | Description |
|---|---|
bytes
|
The rendered image as bytes in the specified format, or empty bytes if return_image is False. |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If the sequences don't all have the same length. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
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 | |
show() -> None
¶
Display the rendered figure in an interactive window.
This method shows the Matplotlib figure. It does nothing when running in test mode (GSP_TEST environment variable set to "True").
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
Markers Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_markers
¶
Matplotlib renderer for Markers objects.
RendererMarkers
¶
Renderer for Markers objects using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_markers.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, markers: Markers, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render the given Markers object onto the specified viewport using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.matplotlib_renderer.MatplotlibRenderer
|
The renderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The viewport to render onto. |
required |
markers
|
gsp.visuals.Markers
|
The Markers object containing marker data. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix. |
required |
camera
|
gsp.core.camera.Camera
|
The camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: A list of Matplotlib artist objects created or updated |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_markers.py
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 | |
Paths Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_paths
¶
Matplotlib renderer for Paths objects.
RendererPaths
¶
Renderer for Paths objects using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_paths.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, paths: Paths, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render the given Paths object onto the specified viewport using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.matplotlib_renderer.MatplotlibRenderer
|
The renderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The viewport to render onto. |
required |
paths
|
gsp.visuals.paths.Paths
|
The Paths object containing path data. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix. |
required |
camera
|
gsp.core.camera.Camera
|
The camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: A list of Matplotlib artist objects created or updated |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_paths.py
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 | |
Pixels Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_pixels
¶
"Renderer for Pixels using Matplotlib.
RendererPixels
¶
Renderer for Pixels using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_pixels.py
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 | |
create_artists(renderer: MatplotlibRenderer, viewport: Viewport, visual: VisualBase, group_count: int) -> None
staticmethod
¶
Create the artists associated with the given visual and group count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.MatplotlibRenderer
|
The Matplotlib renderer. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The viewport for which to create the artists. |
required |
visual
|
gsp.types.visual_base.VisualBase
|
The visual for which to create the artists. |
required |
group_count
|
int
|
The number of groups in the visual. |
required |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_pixels.py
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 | |
destroy_artists(renderer: MatplotlibRenderer, viewport: Viewport, visual: VisualBase, group_count: int) -> None
staticmethod
¶
Destroy the artists associated with the given visual and group count.
Trigger a bug in matplotlib where artists are not properly removed from the axes.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_pixels.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, pixels: Pixels, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render Pixels visual using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.MatplotlibRenderer
|
The MatplotlibRenderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The Viewport in which to render. |
required |
pixels
|
gsp.visuals.pixels.Pixels
|
The Pixels visual to render. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix as a TransBuf. |
required |
camera
|
gsp.core.camera.Camera
|
The Camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: List of Matplotlib artists created/updated. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_pixels.py
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 | |
Points Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_points
¶
Renderer for Points using Matplotlib.
RendererPoints
¶
Renderer for Points using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_points.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, points: Points, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render Points visual using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.matplotlib_renderer.MatplotlibRenderer
|
The MatplotlibRenderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The Viewport in which to render. |
required |
points
|
gsp.visuals.points.Points
|
The Points visual to render. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix as a TransBuf. |
required |
camera
|
gsp.core.camera.Camera
|
The Camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: List of Matplotlib artists created/updated. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_points.py
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 | |
Segments Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_segments
¶
Renderer for Segments using Matplotlib.
RendererSegments
¶
Renderer for Segments using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_segments.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, segments: Segments, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render Segments visual using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.matplotlib_renderer.MatplotlibRenderer
|
The MatplotlibRenderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The Viewport in which to render. |
required |
segments
|
gsp.visuals.segments.Segments
|
The Segments visual to render. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix as a TransBuf. |
required |
camera
|
gsp.core.camera.Camera
|
The Camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: List of Matplotlib artists created/updated. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_segments.py
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 | |
Texts Renderer¶
gsp_matplotlib.renderer.matplotlib_renderer_texts
¶
Renderer for Texts using Matplotlib.
RendererTexts
¶
Renderer for Texts using Matplotlib.
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_texts.py
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 | |
render(renderer: MatplotlibRenderer, viewport: Viewport, texts: Texts, model_matrix: TransBuf, camera: Camera) -> list[matplotlib.artist.Artist]
staticmethod
¶
Render Texts visual using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
gsp_matplotlib.renderer.matplotlib_renderer.MatplotlibRenderer
|
The MatplotlibRenderer instance. |
required |
viewport
|
gsp.core.viewport.Viewport
|
The Viewport in which to render. |
required |
texts
|
gsp.visuals.texts.Texts
|
The Texts visual to render. |
required |
model_matrix
|
gsp.types.transbuf.TransBuf
|
The model transformation matrix as a TransBuf. |
required |
camera
|
gsp.core.camera.Camera
|
The Camera providing view and projection matrices. |
required |
Returns:
| Type | Description |
|---|---|
list[matplotlib.artist.Artist]
|
list[matplotlib.artist.Artist]: List of Matplotlib artists created/updated. |
Source code in src/gsp_matplotlib/renderer/matplotlib_renderer_texts.py
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 | |
Extra Module¶
The extra module provides additional utilities and extensions for Matplotlib rendering.
gsp_matplotlib.extra
¶
GSP Matplotlib extra utilities package initialization.
Bufferx
¶
Utility class for Buffer extended functionality using numpy.
Source code in src/gsp_matplotlib/extra/bufferx.py
7 8 9 10 11 12 13 14 15 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 | |
mat4_identity() -> Buffer
staticmethod
¶
Create a Buffer containing a 4x4 identity matrix.
Source code in src/gsp_matplotlib/extra/bufferx.py
14 15 16 17 18 19 | |
to_numpy(buffer: Buffer) -> np.ndarray
staticmethod
¶
Convert a Buffer to a numpy array.
Source code in src/gsp_matplotlib/extra/bufferx.py
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 | |
from_numpy(array_numpy: np.ndarray, bufferType: BufferType) -> Buffer
staticmethod
¶
Create a Buffer from a numpy array.
Source code in src/gsp_matplotlib/extra/bufferx.py
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 | |
Bufferx¶
gsp_matplotlib.extra.bufferx
¶
Utility class for Buffer extended functionality using numpy.
Bufferx
¶
Utility class for Buffer extended functionality using numpy.
Source code in src/gsp_matplotlib/extra/bufferx.py
7 8 9 10 11 12 13 14 15 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 | |
from_numpy(array_numpy: np.ndarray, bufferType: BufferType) -> Buffer
staticmethod
¶
Create a Buffer from a numpy array.
Source code in src/gsp_matplotlib/extra/bufferx.py
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 | |
mat4_identity() -> Buffer
staticmethod
¶
Create a Buffer containing a 4x4 identity matrix.
Source code in src/gsp_matplotlib/extra/bufferx.py
14 15 16 17 18 19 | |
to_numpy(buffer: Buffer) -> np.ndarray
staticmethod
¶
Convert a Buffer to a numpy array.
Source code in src/gsp_matplotlib/extra/bufferx.py
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 | |
Utils Module¶
The utils module provides converter utilities for the Matplotlib backend.
gsp_matplotlib.utils
¶
Utility module for GSP Matplotlib conversions.
ConverterUtils
¶
Utility class for converting GSP types to Matplotlib types.
Source code in src/gsp_matplotlib/utils/converter_utils.py
10 11 12 13 14 15 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 | |
cap_style_gsp_to_mpl(gsp_cap_style: CapStyle) -> Literal['butt', 'round', 'projecting']
staticmethod
¶
Convert CapStyle enum to Matplotlib string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_cap_style
|
gsp.types.CapStyle
|
The GSP cap style. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
typing.Literal['butt', 'round', 'projecting']
|
The corresponding Matplotlib cap style. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
join_style_gsp_to_mpl(gsp_join_style: JoinStyle) -> Literal['miter', 'round', 'bevel']
staticmethod
¶
Convert JoinStyle enum to Matplotlib string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_join_style
|
gsp.types.JoinStyle
|
The GSP join style. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
typing.Literal['miter', 'round', 'bevel']
|
The corresponding Matplotlib join style. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
marker_shape_gsp_to_mpl(gsp_marker_shape: MarkerShape) -> str
staticmethod
¶
Convert GSP marker shape to Matplotlib marker shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_marker_shape
|
gsp.types.MarkerShape
|
The GSP marker shape. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The corresponding Matplotlib marker shape. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
Converter Utils¶
gsp_matplotlib.utils.converter_utils
¶
Utility class for converting GSP types to Matplotlib types.
ConverterUtils
¶
Utility class for converting GSP types to Matplotlib types.
Source code in src/gsp_matplotlib/utils/converter_utils.py
10 11 12 13 14 15 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 | |
cap_style_gsp_to_mpl(gsp_cap_style: CapStyle) -> Literal['butt', 'round', 'projecting']
staticmethod
¶
Convert CapStyle enum to Matplotlib string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_cap_style
|
gsp.types.CapStyle
|
The GSP cap style. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
typing.Literal['butt', 'round', 'projecting']
|
The corresponding Matplotlib cap style. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
join_style_gsp_to_mpl(gsp_join_style: JoinStyle) -> Literal['miter', 'round', 'bevel']
staticmethod
¶
Convert JoinStyle enum to Matplotlib string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_join_style
|
gsp.types.JoinStyle
|
The GSP join style. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
typing.Literal['miter', 'round', 'bevel']
|
The corresponding Matplotlib join style. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
marker_shape_gsp_to_mpl(gsp_marker_shape: MarkerShape) -> str
staticmethod
¶
Convert GSP marker shape to Matplotlib marker shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gsp_marker_shape
|
gsp.types.MarkerShape
|
The GSP marker shape. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The corresponding Matplotlib marker shape. |
Source code in src/gsp_matplotlib/utils/converter_utils.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |