scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.93k stars 603 forks source link

Change default matplotlib.rcParams["axes.grid"] from True to False #3347

Open senseibence opened 1 week ago

senseibence commented 1 week ago

Description

When creating heatmaps, matrices, and various graphs using large datasets with seaborn, scanpy.set_figure_params() provides helpful default configurations for the plot. However, one default, caused by matplotlib.rcParams["axes.grid"] = True, provides no benefit to the vast majority of plots, making them unreadable and confusing (especially with very large plots). Below is a simple example; evidently, the distortion increases with graph complexity.

Images

Graph with default grid:

graph_with_grid

Graph without default grid:

graph_without_grid

Conclusion

This change simply modifies matplotlib.rcParams["axes.grid"] from True to False, not affecting any other components of the module. We believe this adjusted default would benefit the majority of graphs compared to the original. If one would like to use the grid lines for any reason (which we believe is a niche use case), they may run matplotlib.pyplot.rcParams["axes.grid"] = True.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 76.59%. Comparing base (d0adc25) to head (7562ad2).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3347 +/- ## ======================================= Coverage 76.59% 76.59% ======================================= Files 111 111 Lines 12827 12827 ======================================= Hits 9825 9825 Misses 3002 3002 ``` | [Files with missing lines](https://app.codecov.io/gh/scverse/scanpy/pull/3347?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse) | Coverage Δ | | |---|---|---| | [src/scanpy/plotting/\_rcmod.py](https://app.codecov.io/gh/scverse/scanpy/pull/3347?src=pr&el=tree&filepath=src%2Fscanpy%2Fplotting%2F_rcmod.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NjYW5weS9wbG90dGluZy9fcmNtb2QucHk=) | `100.00% <100.00%> (ø)` | |
senseibence commented 1 week ago

Could someone help with the checks for this PR?