Skip to content

Commit

Permalink
unifying axes for evaluation plots
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikExner committed Sep 11, 2024
1 parent cf32448 commit 51ef620
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
17 changes: 15 additions & 2 deletions cytonormpy/_plotting/_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,20 @@ def splineplot(self,
return_fig = return_fig
)

def _unify_axes_dimensions(self,
ax: Axes) -> None:

axes_min = min(ax.get_xlim()[0], ax.get_ylim()[0])
axes_max = max(ax.get_xlim()[1], ax.get_ylim()[1])
axis_lims = (axes_min, axes_max)
ax.set_xlim(axis_lims)
ax.set_ylim(axis_lims)

def _draw_comp_line(self,
ax: Axes) -> None:
ax.set_ylim(ax.get_xlim())

self._unify_axes_dimensions(ax)

comp_line_x = list(ax.get_xlim())
comp_line_y = comp_line_x
ax.plot(comp_line_x, comp_line_y, color = "red", linestyle = "--")
Expand All @@ -855,7 +866,9 @@ def _draw_comp_line(self,
def _draw_cutoff_line(self,
ax: Axes,
cutoff: float) -> None:
ax.set_ylim(ax.get_xlim())

self._unify_axes_dimensions(ax)

upper_bound_x = list(ax.get_xlim())
upper_bound_y = [val + cutoff for val in upper_bound_x]
lower_bound_x = list(ax.get_ylim())
Expand Down
38 changes: 14 additions & 24 deletions cytonormpy/vignettes/cytonormpy_plotting.ipynb

Large diffs are not rendered by default.

0 comments on commit 51ef620

Please sign in to comment.