Avoid argument explosion in plotting functions
See original GitHub issue- Additional function parameters / changed functionality / changed defaults?
- New analysis tool: A simple analysis tool you have been using and are missing in
sc.tools
? - New plotting function: A kind of plot you would like to seein
sc.pl
? - External tools: Do you know an existing package that should go into
sc.external.*
? - Other?
To reduce the number of arguments that are passed to plotting functions and to agrupate them by type I was considering the following example syntax:
sc.pl.umap(adata, color='clusters').scatter_outline(width=0.1)
.legend(loc='on data', outline=1)
.add_edges(color='black', width=0.1)
or
sc.pl.dotplot(adata, ['gene1', 'gene2'], groupby='clusters')
.add_dendrogram(width=0.4,color='grey')
.swap_axes()
.dot_size_legend(title='fraction', location='left')
Any comments? (I am not sure how to implement something like this)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to Avoid Exploding Gradients With Gradient Clipping
Exploding gradients can be avoided in general by careful configuration of the network model, such as choice of small learning rate, scaled ...
Read more >ggplot2 plot function with several arguments - Stack Overflow
I would like to plot, in one single plot, all results of this function for a range of arguments d and p. In...
Read more >plotrix: Various Plotting Functions
The two justification arguments, 'xjust' and 'yjust' are the same as in the 'legend' ... the two sections of the plot is probably...
Read more >[WIP] Dotplot (aka bubble plot) improvements by fidelram · Pull ...
The dotplot functionality has been separated from the main function. ... of parameters as suggested in Avoid argument explosion in plotting functions #956....
Read more >Combinatorial explosion - Wikipedia
In mathematics, a combinatorial explosion is the rapid growth of the complexity of a problem due to how the combinatorics of the problem...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I like the idea and I see your point, however I wonder how intuitive the concept of a style is for beginners. Also you’d have to know exactly what you are looking to plot during your analysis to set up a style for all plots for the future (e.g. do you need arrows? Will you use a marker gene dotplot?). Context managers definitely look clean (I love that I have my own ^^), but it would make things a bit more difficult for beginners to get an intuitive feel for scanpy.
I support the idea of tidying up plotting arguments. I think there are mainly two problems. 1) the high number of plotting arguments 2) lack of reusability of plotting “styles”.
Chaining looks really cool and improves 1). Also, it logically partitions the plotting arguments. However, it doesn’t solve 2). In other words, if we plot two figures, we’ll need to copy the entire thing, and it’ll be very verbose:
One thing that comes to mind for reusability is to store the result of the chain somewhere and, well, reuse it:
WDYT?