Muon function mofa.plot_factors


I am following Muon’s tutorial “Processing and integrating 5k PBMCs CITE-seq data” and I get an error on the mofa.plot_factors function. This happens both with my data and with the ones provided by the tutorial itself. It’s a value error about a length mismatch, basically the function always expects double of the elements in the list passed to the “color” argument.

Below you can find my code and the error that I get.

Thanks for reading and for your help!


mofa.plot_factors(model, x=1, y=2, color=[“CD45RA_TotalSeqB”, “CD45RO_TotalSeqB”, “CD19_TotalSeqB”], palette=“RdPu”)


ValueError Traceback (most recent call last)
Cell In[127], line 1
----> 1 mofa.plot_factors(model, x=1, y=2, color=[“CD45RA_TotalSeqB”, “CD45RO_TotalSeqB”, “CD19_TotalSeqB”], palette=“RdPu”)

File ~/opt/anaconda3/envs/myenv/lib/python3.10/site-packages/mofax/, in plot_factors_scatter(model, x, y, dist, groups, group_label, color, zero_line_x, zero_line_y, linewidth, zero_linewidth, size, legend, legend_prop, palette, ncols, sharex, sharey, **kwargs)
145 else:
146 plot = partial(
147 sns.scatterplot,
148 s=size,
149 )
→ 150 g = _plot_factors(
151 plot,
152 model,
153 x,
154 y,
155 color,
156 groups=groups,
157 group_label=group_label,
158 zero_line_x=zero_line_x,
159 zero_line_y=zero_line_y,
160 linewidth=linewidth,
161 zero_linewidth=zero_linewidth,
162 legend=legend,
163 legend_prop=legend_prop,

71 f"Length mismatch: Expected axis has {old_len} elements, new "
72 f"values have {new_len} elements"
73 )

ValueError: Length mismatch: Expected axis has 6 elements, new values have 3 elements

Hey @Ffht,

The most recent fix on the dev branch of mofax should make it work. Thanks for reporting!

Yes, it works now. Thank you !