Commit 0135c749 authored by dboe's avatar dboe
Browse files

plotting tensor_maps

parent 136357a5
Pipeline #104637 passed with stages
in 1 minute and 18 seconds
......@@ -66,7 +66,7 @@ dev =
%(docs)s
%(test)s
%(io)s
bumpversion # for incrementing the version
bumpversion==1.0.0 # for incrementing the version
twine # for publishing
sphinx # for documentation
pre-commit # https://pre-commit.com/ for hook managment
......
......@@ -2830,6 +2830,24 @@ class TensorMaps(TensorFields):
paths = sorted_paths
return paths
def plot(self, **kwargs): # pragma: no cover
"""
Forwarding to rna.plotting.plot_mesh
"""
scalars_demanded = (
"color" not in kwargs
and "facecolors" not in kwargs
and any([v in kwargs for v in ["vmin", "vmax", "cmap"]])
)
map_ = self.maps[kwargs.pop("map", 3)]
map_index = kwargs.pop("map_index", None if not scalars_demanded else 0)
if map_index is not None:
if not len(map_) == 0:
kwargs["color"] = map_.fields[map_index]
if map_.dim == 3:
return rna.plotting.plot_mesh(self, map_, **kwargs)
return rna.plotting.plot_tensor_map(self, map_, **kwargs)
if __name__ == "__main__": # pragma: no cover
import doctest
......
......@@ -9,7 +9,6 @@ Triangulated mesh class and methods
import logging
import os
import numpy as np
import rna
import tfields
# obj imports
......@@ -1168,21 +1167,6 @@ class Mesh3D(tfields.TensorMaps):
templates.append(template)
return parts, templates
def plot(self, **kwargs): # pragma: no cover
"""
Forwarding to rna.plotting.plot_mesh
"""
scalars_demanded = (
"color" not in kwargs
and "facecolors" not in kwargs
and any([v in kwargs for v in ["vmin", "vmax", "cmap"]])
)
map_index = kwargs.pop("map_index", None if not scalars_demanded else 0)
if map_index is not None:
if not len(self.maps[3]) == 0:
kwargs["color"] = self.maps[3].fields[map_index]
return rna.plotting.plot_mesh(self, self.faces, **kwargs)
if __name__ == "__main__": # pragma: no cover
import doctest
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment