Repository navigation
all_chain_plotting #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
all_chain_plotting #105
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7749bc9
all_chain_plotting
BadPrograms 34db207
added description
BadPrograms 56bf3ae
quick fix
BadPrograms 382e8e9
fix docstring
BadPrograms 75f2d30
:)
BadPrograms b6e0837
Merge branch 'v3.x' into all_chains_histogram
BadPrograms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -741,3 +741,50 @@ def plot_dtw_trajectory( | |
| ) | ||
|
|
||
| return distance, fig | ||
|
|
||
|
|
||
| def plot_chain_histogram( | ||
| lT: LineageTree, | ||
| *, | ||
| with_leaves: bool = False, | ||
| with_roots: bool = False, | ||
| bins: int = None, | ||
| color: str = "blue", | ||
| ax: plt.Axes | None = None, | ||
| **kwargs, | ||
| ): | ||
| """Plot the histograms of the chains length of the dataset. By default the chains tha tcontain root or leaf ndoes are not included. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| lT : LineageTree | ||
| The LineageTree instance. | ||
| with_leaves : bool, optional | ||
| Include the chains that contain leaves in the histogram, by default False | ||
| with_roots : bool, optional | ||
| Include the chains that contain roots in the histogram, by default False | ||
| bins : int, optional | ||
| Bins of tghe histogram, if none they are set automatically, by default None | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also "if |
||
| color : str, optional | ||
| Color of the histogram, by default "blue" | ||
| ax : plt.Axes | None, optional | ||
| The plt.Axes instance, if None it creates a new Axes instance, by default None | ||
|
|
||
| Returns | ||
| ------- | ||
| plt.Figure | ||
| The matplotlib figure | ||
| plt.Axes | ||
| The matplotlib axes | ||
| """ | ||
|
|
||
| list_of_chains = [c for c in lT.all_chains] | ||
| if not with_roots: | ||
| list_of_chains = [c for c in list_of_chains if c[0] not in lT.roots] | ||
| if not with_leaves: | ||
| list_of_chains = [c for c in list_of_chains if c[-1] not in lT.leaves] | ||
| chain_lens = [len(c) for c in list_of_chains] | ||
| if not ax: | ||
| _, ax = plt.subplots(nrows=1, ncols=1, **kwargs) | ||
| ax.hist(chain_lens, bins, color=color) | ||
| return ax.get_figure(), ax | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not optional, they have default values, there is a difference