Skip to content

Commit f81b5ea

Browse files
authored
raster mesh plotting (#47)
addresses #44
1 parent 804a170 commit f81b5ea

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
66
The format is based on `Keep a Changelog`_,
77
and this project adheres to `Semantic Versioning`_.
88

9+
`1.5.2`_ - 2021-09-09
10+
--------------------------
11+
Fixed
12+
'''''''
13+
- Plotting 3D raster meshes.
14+
915
`1.5.1`_ - 2021-09-09
1016
--------------------------
1117
Fixed
@@ -250,7 +256,8 @@ Added
250256

251257
.. LINKS
252258
253-
.. _`Unreleased`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.1...HEAD
259+
.. _`Unreleased`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.2...HEAD
260+
.. _`1.5.2`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.1...v1.5.2
254261
.. _`1.5.1`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.0...v1.5.1
255262
.. _`1.5.0`: https://github.com/kip-hart/MicroStructPy/compare/v1.4.10...v1.5.0
256263
.. _`1.4.10`: https://github.com/kip-hart/MicroStructPy/compare/v1.4.9...v1.4.10

src/microstructpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
import microstructpy.seeding
55
import microstructpy.verification
66

7-
__version__ = '1.5.1'
7+
__version__ = '1.5.2'

src/microstructpy/meshing/trimesh.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,11 @@ def plot(self, index_by='element', material=[], loc=0, **kwargs):
13291329
plt_value = np.empty(inds.shape, dtype=object)
13301330
for i, val_i in enumerate(value):
13311331
plt_value[inds == i] = val_i
1332+
if 'color' in key:
1333+
unset_mask = plt_value == None
1334+
plt_value[unset_mask] = 'k'
1335+
inds[unset_mask] = -1
1336+
13321337
else:
13331338
plt_value = value
13341339
plt_kwargs[key] = plt_value
@@ -1905,7 +1910,10 @@ def _plot_2d(ax, mesh, index_by, **kwargs):
19051910
else:
19061911
e_str = 'Cannot index by {}.'.format(index_by)
19071912
raise ValueError(e_str)
1908-
v = value[ind]
1913+
try:
1914+
v = value[ind]
1915+
except IndexError:
1916+
v = 'none'
19091917
plt_value.append(v)
19101918
else:
19111919
plt_value = value

0 commit comments

Comments
 (0)