Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #740 #741

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions gempy/plot/_vista.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
try:
import pyvista as pv
import pyvistaqt as pvqt
from pyvista.plotting import parse_color
PYVISTA_IMPORT = True
except ImportError:
PYVISTA_IMPORT = False
Expand Down Expand Up @@ -314,9 +313,9 @@ def call_back_plane_move_changes(self, indices):
plane1.SetCenter(new_center[0], new_center[1], new_center[2])

plane1.GetPlaneProperty().SetColor(
parse_color(self.model._surfaces.df.set_index('id')['color'][new_values_df['id']])) # self.C_LOT[new_values_df['id']])
pv.Color(self.model._surfaces.df.set_index('id')['color'][new_values_df['id']]).float_rgb) # self.C_LOT[new_values_df['id']])
plane1.GetHandleProperty().SetColor(
parse_color(self.model._surfaces.df.set_index('id')['color'][new_values_df['id']]))
pv.Color(self.model._surfaces.df.set_index('id')['color'][new_values_df['id']]).float_rgb)
return True

def plot_orientations(self, orientations=None, clear=True, **kwargs):
Expand Down Expand Up @@ -354,7 +353,7 @@ def plot_surfaces(self, surfaces=None, delete_surfaces=True, **kwargs):

surf = pv.PolyData(val['vertices'], np.insert(val['edges'], 0, 3, axis=1).ravel())
self.surf_polydata.at[idx] = surf
self.vista_surf_actor[idx] = self.p.add_mesh(surf, parse_color(val['color']), **kwargs)
self.vista_surf_actor[idx] = self.p.add_mesh(surf, pv.Color(val['color']).float_rgb, **kwargs)

self.set_bounds()
return self.surf_polydata
Expand Down
4 changes: 1 addition & 3 deletions gempy/plot/vista.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
from typing import Union, Dict, List, Iterable, Set, Tuple

import matplotlib.colors as mcolors
from matplotlib import cm
import numpy as np
import pandas as pd
import pyvista as pv
from pyvista.plotting import parse_color
# TODO Check if this is necessary if it is implemented in the API
try:
import pyvistaqt as pvqt
Expand Down Expand Up @@ -465,7 +463,7 @@ def plot_surfaces(self, surfaces: Union[str, Iterable[str]] = 'all',
# surf['id'] = val['id']
self.surface_poly[val['surface']] = surf
self.surface_actors[val['surface']] = self.p.add_mesh(
surf, parse_color(val['color']), show_scalar_bar=True,
surf, pv.Color(val['color']).float_rgb, show_scalar_bar=True,
cmap=cmap, **kwargs)
self.set_bounds()

Expand Down