zhengrongbin / MEBOCOST

A python-based package and software to predict metabolite mediated cell-cell communications by single-cell RNA-seq data
BSD 3-Clause "New" or "Revised" License
59 stars 10 forks source link

RuntimeError: Colorbar layout of new layout engine not compatible with old engine, and a colorbar has been created. Engine not changed. #26

Closed seekning closed 5 days ago

seekning commented 3 weeks ago

when running this : ?mebo_obj.FlowPlot mebo_obj.FlowPlot( pval_method='permutation_test_fdr', pval_cutoff=0.05, sender_focus=[], metabolite_focus=[], sensor_focus=[], receiver_focus=[], remove_unrelevant = False, and_or='and', node_label_size=12, node_alpha=0.6, figsize=(10, 8), node_cmap='Set1', line_cmap='bwr', line_vmin = None, line_vmax = 15.5, node_size_norm=(20, 150), linewidth_norm=(0.5, 5), save=None, show_plot=True, comm_score_col='Commu_Score', comm_score_cutoff=0.1, text_outline=False, return_fig = False )

under which appeared :

RuntimeError Traceback (most recent call last) Cell In[38], line 3 1 #3.5 代谢流图:可视化代谢物配体到受体间的通讯 2 get_ipython().run_line_magic('pinfo', 'mebo_obj.FlowPlot') ----> 3 mebo_obj.FlowPlot( 4 pval_method='permutation_test_fdr', 5 pval_cutoff=0.05, 6 sender_focus=[], 7 metabolite_focus=[], 8 sensor_focus=[], 9 receiver_focus=[], 10 remove_unrelevant = False, 11 and_or='and', 12 node_label_size=12, 13 node_alpha=0.6, 14 figsize=(10, 8), 15 node_cmap='Set1', 16 line_cmap='bwr', 17 line_vmin = None, 18 line_vmax = 15.5, 19 node_size_norm=(20, 150), 20 linewidth_norm=(0.5, 5), 21 save=None, 22 show_plot=True, 23 comm_score_col='Commu_Score', 24 comm_score_cutoff=0.1, 25 text_outline=False, 26 return_fig = False 27 )

File ~/miniconda3/envs/mebocost/lib/python3.8/site-packages/mebocost-1.0.3-py3.8.egg/mebocost/mebocost.py:1249, in create_obj.FlowPlot(self, pval_method, pval_cutoff, sender_focus, metabolite_focus, sensor_focus, receiver_focus, remove_unrelevant, and_or, node_label_size, node_alpha, figsize, node_cmap, line_cmap, line_vmin, line_vmax, linewidth_norm, node_size_norm, save, show_plot, comm_score_col, comm_score_cutoff, cutoff_prop, text_outline, return_fig) 1246 else: 1247 Pdf = None -> 1249 fig = CP.FlowPlot(comm_res=comm_res, pval_method=pval_method, pval_cutoff=pval_cutoff, 1250 sender_focus = sender_focus, metabolite_focus = metabolite_focus, 1251 sensor_focus = sensor_focus, receiver_focus = receiver_focus, 1252 remove_unrelevant = remove_unrelevant, and_or = and_or, 1253 node_label_size = node_label_size, node_alpha = node_alpha, figsize = figsize, 1254 node_cmap = node_cmap, line_cmap = line_cmap, line_vmin = line_vmin, 1255 line_vmax = line_vmax, linewidth_norm = linewidth_norm, 1256 node_size_norm = node_size_norm, pdf=Pdf, show_plot = show_plot, 1257 comm_score_col = comm_score_col, comm_score_cutoff = comm_score_cutoff, cutoff_prop = cutoff_prop, 1258 text_outline = text_outline, return_fig = return_fig) 1259 if save is not None and save is not False and isinstance(save, str): 1260 Pdf.close()

File ~/miniconda3/envs/mebocost/lib/python3.8/site-packages/mebocost-1.0.3-py3.8.egg/mebocost/crosstalk_plots.py:516, in FlowPlot(comm_res, pval_method, pval_cutoff, sender_focus, metabolite_focus, sensor_focus, receiver_focus, remove_unrelevant, and_or, node_label_size, node_alpha, figsize, node_cmap, line_cmap, line_vmin, line_vmax, linewidth_norm, node_size_norm, pdf, save_plot, show_plot, comm_score_col, comm_score_cutoff, cutoff_prop, text_outline, return_fig) 508 bottom_right.plot([], [], 'g', 509 color = 'black', 510 linewidth = linewidth_norm_fun(label, plot_tmp[comm_score_col]), 511 label = round(label, 4)) 512 bottom_right.legend(title = 'Communication Score', 513 loc='lower center', 514 frameon = False) --> 516 plt.tight_layout() 517 pdf.savefig(fig) if pdf else None 518 if show_plot:

File ~/miniconda3/envs/mebocost/lib/python3.8/site-packages/matplotlib/pyplot.py:2265, in tight_layout(pad, h_pad, w_pad, rect) 2263 @_copy_docstring_and_deprecators(Figure.tight_layout) 2264 def tight_layout(*, pad=1.08, h_pad=None, w_pad=None, rect=None): -> 2265 return gcf().tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)

File ~/miniconda3/envs/mebocost/lib/python3.8/site-packages/matplotlib/figure.py:3442, in Figure.tight_layout(self, pad, h_pad, w_pad, rect) 3439 engine = TightLayoutEngine(pad=pad, h_pad=h_pad, w_pad=w_pad, 3440 rect=rect) 3441 try: -> 3442 self.set_layout_engine(engine) 3443 engine.execute(self) 3444 finally:

File ~/miniconda3/envs/mebocost/lib/python3.8/site-packages/matplotlib/figure.py:2584, in Figure.set_layout_engine(self, layout, **kwargs) 2582 self._layout_engine = new_layout_engine 2583 else: -> 2584 raise RuntimeError('Colorbar layout of new layout engine not ' 2585 'compatible with old engine, and a colorbar ' 2586 'has been created. Engine not changed.')

RuntimeError: Colorbar layout of new layout engine not compatible with old engine, and a colorbar has been created. Engine not changed.

can i trust the running result it gave me? My plsearue to apply your code on single cell sequencing

zhengrongbin commented 2 weeks ago

Hi, this seems matplotlib version problem. Which version of mebocost are you using, and which version of matplotlib are you using? Please let me know if you still get this error even if you install the matplotlib and other dependencies using the versions in the requirements.txt.