Skip to content

Commit

Permalink
Enhance plot_scenes() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Pechnikov committed May 19, 2024
1 parent 5cc42cc commit be55464
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pygmtsar/pygmtsar/Stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def plot_POI(geometry=None, **kwargs):
marker_color = kwargs['marker_color']
geometry.plot(ax=plt.gca(), marker=marker, markersize=marker_size, color=marker_color)

def plot_scenes(self, dem='auto', image=None, caption='Estimated Scene Locations', cmap='turbo', aspect=None, **kwargs):
def plot_scenes(self, dem='auto', image=None, alpha=None, caption='Estimated Scene Locations', cmap='turbo', aspect=None, **kwargs):
import matplotlib.pyplot as plt
import matplotlib

plt.figure()
if image is not None:
image.plot.imshow(cmap='gray', add_colorbar=False)
image.plot.imshow(cmap='gray', alpha=alpha, add_colorbar=False)
if isinstance(dem, str) and dem == 'auto':
if self.dem_filename is not None:
dem = self.get_dem()
Expand All @@ -133,9 +133,9 @@ def plot_scenes(self, dem='auto', image=None, caption='Estimated Scene Locations
cmap = matplotlib.colormaps[cmap]
colors = dict([(v, cmap(k)) for k, v in enumerate(gdf.index.unique())])
# too small an alpha becomes invisible
alpha = 0.5/len(gdf)
alpha = alpha if alpha>=0.002 else 0.002
gdf.reset_index().plot(color=[colors[k] for k in gdf.index], alpha=alpha, edgecolor='black', ax=plt.gca())
gdf_alpha = 0.5/len(gdf)
gdf_alpha = gdf_alpha if gdf_alpha>=0.002 else 0.002
gdf.reset_index().plot(color=[colors[k] for k in gdf.index], alpha=gdf_alpha, edgecolor='black', ax=plt.gca())
self.plot_AOI(**kwargs)
self.plot_POI(**kwargs)
if aspect is not None:
Expand Down

0 comments on commit be55464

Please sign in to comment.