dylanplummer commited on
Commit
0d9ab7b
·
1 Parent(s): 5130a4e

fix violin fr

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -193,13 +193,15 @@ def perturb(gene, locus1, locus2):
193
  # convert from argb to rgba
194
  image_from_plot = image_from_plot[:, :, [1, 2, 3, 0]]
195
 
196
- fig = sc.pl.violin(rna, gene, groupby='celltype', return_fig=True, show=False)
 
197
  fig.canvas.draw()
198
  violin_img = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
199
  violin_img = violin_img.reshape(fig.canvas.get_width_height()[::-1] + (4,))
200
  violin_img = violin_img[:, :, [1, 2, 3, 0]]
201
 
202
- fig = sc.pl.violin(rna, 'log2FC', groupby='celltype', return_fig=True, show=False)
 
203
  fig.canvas.draw()
204
  violin_img_fc = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
205
  violin_img_fc = violin_img_fc.reshape(fig.canvas.get_width_height()[::-1] + (4,))
 
193
  # convert from argb to rgba
194
  image_from_plot = image_from_plot[:, :, [1, 2, 3, 0]]
195
 
196
+ fig, ax = plt.subplots(figsize=(6, 6))
197
+ sc.pl.violin(rna, gene, groupby='celltype', show=False, ax=ax)
198
  fig.canvas.draw()
199
  violin_img = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
200
  violin_img = violin_img.reshape(fig.canvas.get_width_height()[::-1] + (4,))
201
  violin_img = violin_img[:, :, [1, 2, 3, 0]]
202
 
203
+ fig, ax = plt.subplots(figsize=(6, 6))
204
+ sc.pl.violin(rna, 'log2FC', groupby='celltype', show=False, ax=ax)
205
  fig.canvas.draw()
206
  violin_img_fc = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
207
  violin_img_fc = violin_img_fc.reshape(fig.canvas.get_width_height()[::-1] + (4,))