change location of add_totals values for sc.pl.dotplot
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
What kind of feature would you like to request?
Additional function parameters / changed functionality / changed defaults?
Please describe your wishes
Hi!
I've been playing around with the add_totals method for dotplot.
My general issue is that the labels on the barplots showing the number of cells per group is slightly covered by the barplot/too far to the left.
I think this could be fixed by changing ha="center" to ha="left" in the _plot_totals function
https://github.com/scverse/scanpy/blob/ec7f92524e6269e9c7370fc94c53ba04230b0bca/scanpy/plotting/_baseplot_class.py#L481
and then possibly moving the axes of the legends further to the right:
I'm moving the axis manually, but it would be nice for it to automatically to move the axis, so that it is always a clear visualization.
size_legend_ax = dp.get_axes()["size_legend_ax"]
size_pos = size_legend_ax.get_position()
size_legend_ax.set_position([size_pos.x0 + 0.05, size_pos.y0, size_pos.width, size_pos.height])
color_legend_ax = dp.get_axes()["color_legend_ax"]
color_pos = color_legend_ax.get_position()
color_legend_ax.set_position([color_pos.x0 + 0.05, color_pos.y0 - 0.05, color_pos.width, color_pos.height])
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scanpy/plotting/_baseplot_class.py at _plot_totals, using sc.pl.dotplot with add_totals to reproduce the label overlap. Check how the size_legend_ax and color_legend_ax positions are created and adjusted. Done means totals labels are no longer covered and the legends remain clearly positioned without manual axis movement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100