Skip to content

Commit

Permalink
Enhance bursts transparency calculation in plot_scenes()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Aug 3, 2024
1 parent 0522607 commit be43475
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pygmtsar/pygmtsar/Stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,13 @@ def plot_scenes(self, dem='auto', image=None, alpha=None, caption='Estimated Sce
gdf = self.to_dataframe()
cmap = matplotlib.colormaps[cmap]
colors = dict([(v, cmap(k)) for k, v in enumerate(gdf.index.unique())])
# too small an alpha becomes invisible
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())

# Calculate overlaps including self-overlap
overlap_count = [sum(1 for geom2 in gdf.geometry if geom1.intersects(geom2)) for geom1 in gdf.geometry]
# define transparency for the calculated overlaps
gdf_alpha = 1/max(overlap_count)
# apply minimum transparency threshold
gdf.reset_index().plot(color=[colors[k] for k in gdf.index], alpha=max(gdf_alpha, 0.002), edgecolor='black', ax=plt.gca())
self.plot_AOI(**kwargs)
self.plot_POI(**kwargs)
if aspect is not None:
Expand Down

0 comments on commit be43475

Please sign in to comment.