-
Notifications
You must be signed in to change notification settings - Fork 589
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
Legend alignment in dotplot #1103
Comments
Huh. As far as I can tell, this seems to happen only if there are 3 or less groups. |
Probably has something to do with this: |
This seems like a bad idea, no? It also seems to throw off the legend other than the colorbar. |
In #1127 I changed the way that the colorbar and size legend are plotted and should solve this problem. |
This is being fixed in #1210 for the time being you can try to set |
* Unifies common code between `dotplot`, `matrixplot` and `stacked_violin` plots while adding flexibility to the plots. sc.pl.dotplot`, `sc.pl.matrixplot` and `sc.pl.stacked_violin` methods had been transformed into wrappers for the new `DotPlot`, `MatrixPlot` and `StackedVioling` classes. Accessing the new classes directly allows further fine tuning of the plots. * The new plot classes are all descendants of `BasePlot` class that captures the common code. The design of the classes follows the method chaining (as found in Pandas or Altair). This allows the addition of independent features (via well documented methods) to the plot without increasing the number parameters of a single function. This was first suggested here #956. All objects have consistent functions for `legend`, to set up titles and width, `style()` to set visual parameters specific to each plot like colormap, edge color, linewidth. `swap_axes` to transpose the figure, `add_dendrogram` with options to change the with of the dendrogran and `add_total` tho show a bar plot of the total number of cells per category. Also includes options to sort the categories. * Previous functionality is maintained but plots will look slightly different. * This commit addresses issues from #979 and #1103 related to `sc.pl.dotplot` * Now is possible to plot fold changes, log fold changes and p-values from `sc.tl.rank_genes_groups` as suggested in #562 Specific changes: **all figures**: * Set a title to the image. * Pass an `axe` where to plot the image. * Return a dictionary of axes for further manipulation * using `return_fig` the plot object can be used to adjust the proportions to the legend and other visual aspects can be fine tuned. * a bar plot with the totals per category can be added. This will align at the left of the image if the categories are plotted in rows or at the top if they are plotted in columns. * legend can be removed * `groupby` can be a list of categories. **dotplot** * Improved the colorbar and size legend for dotplots. Now the colorbar and size have titles, which can be modified using the `colorbar_title` and `size_title` arguments. They also align at the bottom of the image and do not shrink if the dotplot image is smaller. * Plot genes in rows and categories in columns (swap_axes). * Using the DotPlot object the dot_edge_color and line width can be set up, a grid added as well as several other features * `sc.pl.rank_genes_groups_dotplot` can now plot `pvals` and `log fold changes` **matrixplot** * added title for colorbar and positioned as in dotplot * `sc.pl.rank_genes_groups_matrixplot` can now plot `pvals` and `log fold changes` **stacked_violin** * violin colors can be colored based on average gene expression as in dotplots * made the linewidth of the violin plots smaller. * removed the tics for the y axis as they tend to overlap with each other. Using the `style` method they can be visualized. **other** * `sc.pl.heatmap` and `sc.pl.trackplots` now return a dictionary of axes when `show=False` as for the other plots. * now 'interpolation' can be passed as parameter for `sc.pl.heatmap`
Hey!
The color bar and legend don't seem to align well... might be because i'm subsetting the object.
Here is what happens (reproducible example and my plot, which is even stranger with legend overlap):
Versions:
Also, matplotlib is 3.1.3
The text was updated successfully, but these errors were encountered: