Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderCaichen committed Nov 7, 2023
1 parent b1a9f33 commit c1de6d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dynamo/plot/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2709,7 +2709,7 @@ def dynamics(
elif experiment_type == "coassay":
pass # show protein velocity (steady state and the Gamma distribution model)
# g.autofmt_xdate(rotation=-30, ha='right')
return save_show_ret("dynamic", save_show_or_return, save_kwargs, g)
return save_show_ret("dynamics", save_show_or_return, save_kwargs, g)


def dynamics_(
Expand Down
2 changes: 1 addition & 1 deletion dynamo/plot/least_action_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ def lap_min_time(
# scatters(adata, basis=basis, color=color, ax=axes[i, j], **kwargs)
# axes[i, j].scatter(*i[:, [x, y]].T, c=map2color(j))

return save_show_ret("kinetic_curves", save_show_or_return, save_kwargs, None)
return save_show_ret("kinetic_curves", save_show_or_return, save_kwargs)
4 changes: 2 additions & 2 deletions dynamo/plot/scVectorField.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ def cell_wise_vectors(
)
ax.set_facecolor(background)

return save_show_ret("cell_wise_vector", save_show_or_return, save_kwargs, axes_list, projection != "3d")
return save_show_ret("cell_wise_vector", save_show_or_return, save_kwargs, axes_list, tight = projection != "3d")


@docstrings.with_indent(4)
Expand Down Expand Up @@ -1734,7 +1734,7 @@ def streamplot_2d(ax):
ax = axes_list[i]
streamplot_2d(ax)

return save_show_ret("stream_plot", save_show_or_return, save_kwargs, axes_list)
return save_show_ret("streamline_plot", save_show_or_return, save_kwargs, axes_list)


# refactor line_conv_integration
Expand Down
11 changes: 4 additions & 7 deletions dynamo/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import pandas as pd
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
from matplotlib.axes import Axes
from scipy.spatial import Delaunay

from ..configuration import _themes, reset_rcParams
Expand Down Expand Up @@ -1693,18 +1692,18 @@ def save_show_ret(
as its parameters. save_kwargs modifies those keys according to your needs. Defaults to {}.
ret_value: value to be returned if save_show_or_return equals "return" or "all".
- Note that functions in heatmaps.py don't use save_show_or_return to determine if anything's returned.
tight: because cell_wise_vectors_3d() and cell_wise_vectors() in scVectorField.py do not call plt.tight_layout()
adjust: because scatters.py, state_graph.py, and time_series.py potentially call plt.subplots_adjust()
tight: because cell_wise_vectors_3d() and cell_wise_vectors() in scVectorField.py do not call plt.tight_layout().
adjust: scatters.py, state_graph.py, and time_series.py potentially call plt.subplots_adjust().
- Note that some functions, such as scatters(), pass in a string rather than a boolean.
background: because bubble() in markers.py and scatters() in scatters.py use this to see if reset_rcParams() is called
background: bubble() in markers.py/scatters() in scatters.py use this to see if reset_rcParams() is called.
Returns:
None would be returned by default. If `save_show_or_return` is set to be `"return"` or `"all"`, the matplotlib
axis of the generated figure would be returned.
Notes regarding save_show_or_return sections in functions that are not replaced with save_show_ret():
- arcPlot()/nxvizPlot() in networks.py: uses plt.autoscale() or nv_ax.draw() in the first 2 IF statements.
- plot_3d_streamtube() in streamtube.py/animate_fates() in fate.py uses a different dictionary format than s_kwargs
- plot_3d_streamtube() in streamtube.py/animate_fates() in fate.py uses a different dictionary format than s_kwargs.
"""
if save_show_or_return in ["save", "both", "all"]:
s_kwargs = {
Expand Down Expand Up @@ -1744,13 +1743,11 @@ def save_show_ret(
reset_rcParams()
return ret_value
else:
#Functionally this is unnecessary but adding it is better for readability.
return None
#Unnessary because type hint handles cases where save_show_or_return is not accepted options.
#raise NotImplementedError('Invalid "save_show_or_return".') (connectivity.py)



def retrieve_plot_save_path(
path: Optional[str] = None,
prefix: Optional[str] = None,
Expand Down

0 comments on commit c1de6d4

Please sign in to comment.