Skip to content
Draft
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
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