Skip to content

Commit

Permalink
Added new parameters to Tie_Point_Grid.plot_shift_distribution(). Add…
Browse files Browse the repository at this point in the history
…ed documentation to COREG_LOCAL.view_CoRegPoints(). Bumped version and updated HISTORY.rst.

Signed-off-by: Daniel Scheffler <danschef@gfz-potsdam.de>
  • Loading branch information
danschef committed Sep 29, 2021
1 parent 42c23d8 commit 9bd9140
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
History
=======

1.6.2 (2021-09-29)
------------------

* Fixed 'too many values to unpack' exception in COREG_LOCAL.view_CoRegPoints().
* Added new parameters to Tie_Point_Grid.plot_shift_distribution().
* Added documentation to COREG_LOCAL.view_CoRegPoints().


1.6.1 (2021-09-29)
------------------

Expand Down
14 changes: 7 additions & 7 deletions arosics/CoReg_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,13 @@ def view_CoRegPoints(self,
:param figsize_multiplier: if given, the figure size is multiplied with this value
:param title: plot title
:param vector_scale: scale factor for shift vector length (default: 1 -> no scaling)
:param savefigPath:
:param savefigDPI:
:param showFig: whether to show or to hide the figure
:param vmin:
:param vmax:
:param return_map:
:return:
:param savefigPath: path where to save the figure
:param savefigDPI: DPI resolution of the output figure when saved to disk (default: 96)
:param showFig: whether to show or to hide the figure (default: True)
:param vmin: minimum value of 'attribute2plot' to be included in the figure
:param vmax: maximum value of 'attribute2plot' to be included in the figure
:param return_map: whether to return the figure and axis objects (default: False)
:return: tuple of figure and axis objects or None in case return_map is set to False
"""
from matplotlib import pyplot as plt # noqa
from matplotlib.offsetbox import AnchoredText
Expand Down
26 changes: 22 additions & 4 deletions arosics/Tie_Point_Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,26 @@ def plot_shift_distribution(self,
xlim: list = None,
ylim: list = None,
fontsize: int = 12,
title: str = 'shift distribution'
title: str = 'shift distribution',
savefigPath: str = '',
savefigDPI: int = 96,
showFig: bool = True,
return_fig: bool = False
) -> tuple:
"""Create a 2D scatterplot containing the distribution of calculated X/Y-shifts.
:param include_outliers: whether to include tie points that have been marked as false-positives
:param unit: 'm' for meters or 'px' for pixels (default: 'm')
:param interactive: interactive mode uses plotly for visualization
:param interactive: whether to use interactive mode (uses plotly for visualization)
:param figsize: (xdim, ydim)
:param xlim: [xmin, xmax]
:param ylim: [ymin, ymax]
:param fontsize: size of all used fonts
:param title: the title to be plotted above the figure
:param savefigPath: path where to save the figure
:param savefigDPI: DPI resolution of the output figure when saved to disk
:param showFig: whether to show or to hide the figure
:param return_fig: whether to return the figure and axis objects
"""
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -598,9 +606,19 @@ def plot_shift_distribution(self,
leg = plt.legend(reversed(handles), reversed(labels), fontsize=fontsize, loc='upper right', scatterpoints=3)
leg.get_frame().set_edgecolor('black')

plt.show()
# remove white space around the figure
plt.subplots_adjust(top=.94, bottom=.06, right=.96, left=.09)

return fig, ax
if savefigPath:
fig.savefig(savefigPath, dpi=savefigDPI, pad_inches=0.3, bbox_inches='tight')

if return_fig:
return fig, ax

if showFig and not self.q:
plt.show(block=True)
else:
plt.close(fig)

def dump_CoRegPoints_table(self, path_out=None):
if self.CoRegPoints_table.empty:
Expand Down
4 changes: 2 additions & 2 deletions arosics/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# limitations under the License.


__version__ = '1.6.1'
__versionalias__ = '2021-09-29_01'
__version__ = '1.6.2'
__versionalias__ = '2021-09-29_02'

0 comments on commit 9bd9140

Please sign in to comment.