You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `pixel` of a `Sensor` object can be visualized as arrows representing the values of the vector fields B, H, J, or M. This allows for quick and intuitive inspection of the field distributions.
581
+
582
+
### Parameters (`style.pixel.field`)
583
+
584
+
-**`source`***(default=`None`)*:
585
+
Defines the field source of the vector field representation.
586
+
-`None`: No field representation is shown
587
+
-`"B"`, `"Hxy"`, `"Jxyz"`, etc.: Colors are mapped to the magnitude of the specified field.
588
+
589
+
-**`symbol`***(default=`"cone"`)*:
590
+
Specifies the rendering symbol for field values.
591
+
-`"none"`: `pixel.symbol` representation takes precedence of `pixel.field.symbol`.
592
+
-`"cone"`: 3D cone representation.
593
+
-`"arrow3d"`: 3D arrow representation.
594
+
-`"arrow"`: 2D line-based arrow.
595
+
596
+
-**`shownull`***(default=`True`)*:
597
+
Toggles the visibility of pixel with zero and invalid field vectors.
598
+
-`True`: Null vectors are displayed.
599
+
-`False`: Null vectors are hidden.
600
+
601
+
-**`sizescaling`***(default=`"uniform"`)*:
602
+
Determines how arrow size relates to the `source` magnitude.
603
+
-`"uniform"`: Uniform arrow size.
604
+
-`"linear"`: Size proportional to magnitude.
605
+
-`"log"`: Size proportional to the normalized logarithm of the magnitude.
606
+
-`"log^n"`: Size proportional to the normalized nth (2 to 9) logarithm of the magnitude.
607
+
608
+
-**`sizemin`***(default=`0.1`)*
609
+
Minimum relative size of field symbols. A float between 0 and 1.
610
+
When displaying field vectors this controls how small the symbols
611
+
can become relative to their maximum size. A value of 0 allows symbols to shrink to zero size,
612
+
while 0.5 ensures symbols are at least 50% of their maximum size.
613
+
614
+
-**`colorscaling`***(default=`"uniform"`)*:
615
+
Determines how arrow color relates to the `source` magnitude.
616
+
-`"uniform"`: Uniform color for all arrows.
617
+
-`"linear"`: Color scaling proportional to magnitude.
618
+
-`"log"`: Color scaling proportional to the normalized logarithm of the magnitude.
619
+
-`"log^n"`: Color scaling proportional to the normalized nth (2 to 9) logarithm of the magnitude.
620
+
621
+
-**`colormap`***(default=`"Viridis"`)*:
622
+
Specifies the colormap used for color mapping. Supports standard color maps (e.g., `"Viridis"`, `"Inferno"`, `"Magma"`, etc.) compatible with both Plotly and Matplotlib.
623
+
624
+
```{note}
625
+
- Pixels with zero or invalid field values are rendered using the default representation (`point`/`box` or according to `style.pixel.symbol`).
626
+
- Magnitude normalization is performed individually for each sensor along its path.
627
+
- `style.pixel.size` controls also the arrow size.
628
+
```
629
+
630
+
### Pixel Field Minimal Example
631
+
632
+
The following example demonstrates how to visualize the `Sensor` pixel array as a vector field using the `style.pixel.field` settings.
633
+
634
+
```{code-cell} ipython3
635
+
:tags: [hide-input]
636
+
637
+
import numpy as np
638
+
import magpylib as magpy
639
+
640
+
# Define a cuboid magnet
641
+
cube = magpy.magnet.Cuboid(
642
+
polarization=(0, 0, 1),
643
+
dimension=(1, 1, 1),
644
+
)
645
+
646
+
# Create a 2D grid of pixel positions in the xy-plane
0 commit comments