Closed quantumdot closed 4 months ago
Can you try with a previous version of adjustText? such as 0.7.3
Downgraded to adjusttext==0.8
, and now the exception I reported above is avoided, and the plots now look as they are supposed to. However, I now encounter a different exception:
IndexError Traceback (most recent call last)
Cell In[24], line 1
----> 1 g=scf.pl.trends(adata, plot_emb=False, highlight_features=[], ordering="max",
2 fig_heigth=6, pseudo_cmap=flat_huslmap, ord_thre=.95, return_genes=True)
3 scf.pl.matrix(adata, features=g, nbins=20,
4 cmap="RdBu_r", annot_top=False,
5 colorbar_title="max\nnormalized\nactivity")
File c:\Users\username\AppData\Local\miniconda3\envs\scFates\lib\site-packages\scFates\plot\features.py:452, in trends(adata, features, cluster, highlight_features, n_features, root_milestone, milestones, module, branch, annot, title, feature_cmap, pseudo_cmap, plot_emb, plot_heatmap, wspace, show_segs, basis, heatmap_space, offset_names, fontsize, style, ordering, ord_thre, figsize, axemb, show, output_mean, save, return_genes, **kwargs)
447 axheatmap.add_patch(patch)
448 axheatmap.hlines(
449 fitted_sorted.shape[0], 0, fitted_sorted.shape[1], color="k", clip_on=True
450 )
--> 452 adjust_text(
453 texts,
454 ax=axheatmap,
455 add_objects=[patch],
456 va="center",
457 ha="left",
458 autoalign=False,
459 expand_text=(1.05, 1.2),
460 lim=5000,
461 only_move={"text": "y", "objects": "x"},
462 precision=0.1,
463 expand_points=(1.2, 1.05),
464 )
466 for i in range(len(xs)):
467 xx = [
468 xs[i] + 1,
469 fitted_sorted.shape[1] + fitted_sorted.shape[1] * offset_names,
470 ]
File c:\Users\username\AppData\Local\miniconda3\envs\scFates\lib\site-packages\adjustText\__init__.py:567, in adjust_text(texts, x, y, add_objects, ax, expand_text, expand_points, expand_objects, expand_align, autoalign, va, ha, force_text, force_points, force_objects, lim, precision, only_move, avoid_text, avoid_points, avoid_self, save_steps, save_prefix, save_format, add_step_numbers, *args, **kwargs)
565 ax = ax or plt.gca()
566 r = get_renderer(ax.get_figure())
--> 567 transform = texts[0].get_transform()
568 if (x is not None) & (y is not None):
569 for ix, tupxy in enumerate(zip(x, y)):
IndexError: list index out of range
Finally, I tried adjusttext==0.7.3
and receive no errors. It would be nice if requirements.txt
was updated to pin adjusttext
package version accordingly.
This now fixed with scfates v1.0.7, thanks for the notice!
While attempting to plot trends for found clusters:
I encountered the following exception:
In order to workaround the exception, I found the following patch to
adjustText/__init__.py
in theadjustText
package allowed me to continue analysis and at least produce plots. The idea is to ensure these four keys are present in theonly_move
dict which should prevent the exception, but this is probably a pretty naïve fix.Although I can now produce the plots, they seem to have an issue with the label positioning:![image](https://github.com/LouisFaure/scFates/assets/8483606/1ddd0b52-34a7-49a1-8512-c091edf72e1a)
Here is my conda environment: