Skip to content

Commit

Permalink
fix(plots): synchronize vector field color map with rainbowplots
Browse files Browse the repository at this point in the history
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
  • Loading branch information
cameronraysmith committed Sep 13, 2024
1 parent fd6c652 commit 76ffc3f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pyrovelocity/plots/_vector_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import seaborn as sns
from anndata import AnnData
from beartype import beartype
from beartype.typing import Dict, List, Optional, Tuple
from beartype.typing import Any, Dict, List, Optional, Tuple
from matplotlib.axes import Axes
from matplotlib.colors import Normalize
from matplotlib.figure import FigureBase
Expand All @@ -23,7 +23,7 @@
get_posterior_sample_angle_uncertainty,
)
from pyrovelocity.styles import configure_matplotlib_style
from pyrovelocity.utils import quartile_coefficient_of_dispersion
from pyrovelocity.utils import quartile_coefficient_of_dispersion, setup_colors

__all__ = [
"plot_vector_field_summary",
Expand Down Expand Up @@ -82,7 +82,7 @@ def plot_vector_field_summary(
vector_field_basis: str,
plot_name: Optional[PathLike | str] = None,
cell_state: str = "cell_type",
state_color_dict: Optional[Dict[str, str]] = None,
state_color_dict: Optional[Dict[str, Any]] = None,
fig: Optional[FigureBase] = None,
gs: Optional[SubplotSpec] = None,
default_fontsize: int = 7 if matplotlib.rcParams["text.usetex"] else 6,
Expand Down Expand Up @@ -114,6 +114,9 @@ def plot_vector_field_summary(
}
)

if state_color_dict is None:
state_color_dict = setup_colors(adata, cell_state)

sns.scatterplot(
x="X1",
y="X2",
Expand Down

0 comments on commit 76ffc3f

Please sign in to comment.