Skip to content
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
8 changes: 7 additions & 1 deletion gempy_viewer/API/_plot_2d_sections_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ def plot_sections(gempy_model: GeoModel, sections_data: list[SectionData2D], dat
kwargs_scalar_field: dict = None,
kwargs_lithology: dict = None,
kwargs_boundaries: dict = None,
kwargs_surface_points: dict = None,
kwargs_orientations: dict = None,
):
kwargs_lithology = kwargs_lithology if kwargs_lithology is not None else {}
kwargs_scalar_field = kwargs_scalar_field if kwargs_scalar_field is not None else {}
kwargs_topography = kwargs_topography if kwargs_topography is not None else {}
kwargs_surface_points = kwargs_surface_points if kwargs_surface_points is not None else {}
kwargs_orientations = kwargs_orientations if kwargs_orientations is not None else {}

series_n = series_n if series_n is not None else [0]

Expand All @@ -43,7 +47,9 @@ def plot_sections(gempy_model: GeoModel, sections_data: list[SectionData2D], dat
orientations_colors=gempy_model.structural_frame.orientations_colors_per_item,
orientations=gempy_model.orientations_copy.df.copy(),
points=gempy_model.surface_points_copy.df.copy(),
slicer_data=section_data.slicer_data
slicer_data=section_data.slicer_data,
kwargs_surface_points=kwargs_surface_points,
kwargs_orientations=kwargs_orientations,
)

if data_to_show.show_lith[e] is True:
Expand Down
3 changes: 2 additions & 1 deletion gempy_viewer/modules/plot_2d/drawer_contours_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ def plot_regular_grid_contacts(gempy_model: GeoModel, ax: matplotlib.axes.Axes,
kwargs = {}

zorder = kwargs.get('zorder', 100)
contour_colors = kwargs.get('contour_colors', None)

shape = resolution
c_id = 0 # * color id startpoint
all_colors = gempy_model.structural_frame.elements_colors_contacts
all_colors = contour_colors if contour_colors is not None else gempy_model.structural_frame.elements_colors_contacts

for e, block in enumerate(gempy_model.solutions.raw_arrays.scalar_field_matrix):
_scalar_field_per_surface = np.where(gempy_model.solutions.raw_arrays.scalar_field_at_surface_points[e] != 0)
Expand Down
53 changes: 36 additions & 17 deletions gempy_viewer/modules/plot_2d/drawer_input_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,60 @@

# TODO: This could be public and the slice just a class yes!
def draw_data(ax, surface_points_colors: list[str], orientations_colors: list[str],
orientations: 'pd.DataFrame', points: 'pd.DataFrame', slicer_data: SlicerData):
orientations: 'pd.DataFrame', points: 'pd.DataFrame', slicer_data: SlicerData,
kwargs_surface_points: dict = None,
kwargs_orientations: dict = None):

_draw_surface_points(ax, points, slicer_data, surface_points_colors)
_draw_orientations(ax, orientations, orientations_colors, slicer_data)
kwargs_surface_points = kwargs_surface_points if kwargs_surface_points is not None else {}
kwargs_orientations = kwargs_orientations if kwargs_orientations is not None else {}

_draw_surface_points(ax, points, slicer_data, surface_points_colors, **kwargs_surface_points)
_draw_orientations(ax, orientations, orientations_colors, slicer_data, **kwargs_orientations)


def _draw_orientations(ax, orientations, orientations_colors, slicer_data):
def _draw_orientations(ax, orientations, orientations_colors, slicer_data, **kwargs):
sel_ori = orientations[slicer_data.select_projected_o]
aspect = np.subtract(*ax.get_ylim()) / np.subtract(*ax.get_xlim())
min_axis = 'width' if aspect < 1 else 'height'

# Default values that can be overridden by kwargs
default_kwargs = {
'pivot': 'tail',
'scale_units': min_axis,
'scale': 30,
'color': np.array(orientations_colors)[slicer_data.select_projected_o],
'edgecolor': 'k',
'headwidth': 8,
'linewidths': 1,
'zorder': 102
}
default_kwargs.update(kwargs)

ax.quiver(
sel_ori[slicer_data.x],
sel_ori[slicer_data.y],
sel_ori[slicer_data.Gx],
sel_ori[slicer_data.Gy],
pivot="tail",
scale_units=min_axis,
scale=30,
color=np.array(orientations_colors)[slicer_data.select_projected_o],
edgecolor='k',
headwidth=8,
linewidths=1,
zorder=102
**default_kwargs
)


def _draw_surface_points(ax, points, slicer_data, surface_points_colors):
def _draw_surface_points(ax, points, slicer_data, surface_points_colors, **kwargs):
points_df = points[slicer_data.select_projected_p]

# Default values that can be overridden by kwargs
default_kwargs = {
'c': np.array(surface_points_colors)[slicer_data.select_projected_p],
's': 70,
'edgecolors': 'white',
'zorder': 102
}
default_kwargs.update(kwargs)

ax.scatter(
points_df[slicer_data.x],
points_df[slicer_data.y],
c=(np.array(surface_points_colors)[slicer_data.select_projected_p]),
s=70,
edgecolors='white',
zorder=102
**default_kwargs
)


Expand Down
1 change: 0 additions & 1 deletion requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ gempy
imagehash
pillow
pydantic
gempy_engine>=2025.2.0dev0,<2025.3.0
gempy>=2025.2.0dev0,<2025.3.0
1 change: 0 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
matplotlib
numpy
gempy_engine>=2025.3dev0