Ronak Ramachandran
commited on
Commit
•
0e81095
1
Parent(s):
8a7b5b1
force plt clear at start
Browse files
app.py
CHANGED
@@ -283,10 +283,8 @@ def plot_scatter_hist(x_gene, y_gene, mode='raw'):
|
|
283 |
def plt_to_img():
|
284 |
fig = plt.gcf()
|
285 |
fig.canvas.draw()
|
286 |
-
|
287 |
'RGB', fig.canvas.get_width_height(), fig.canvas.tostring_rgb())
|
288 |
-
plt.close('all')
|
289 |
-
return image
|
290 |
|
291 |
def random_gene():
|
292 |
return np.random.default_rng().choice(gene_table.columns.values)
|
@@ -307,6 +305,7 @@ def plot_two_genes(x_gene, y_gene, is_normed):
|
|
307 |
return plt_to_img(), f"{x_gene} vs. {y_gene}"
|
308 |
|
309 |
def picker(only_one_gene, x_gene, y_gene, is_normed):
|
|
|
310 |
if only_one_gene:
|
311 |
return plot_one_gene(x_gene)
|
312 |
return plot_two_genes(x_gene, y_gene, is_normed)
|
|
|
283 |
def plt_to_img():
|
284 |
fig = plt.gcf()
|
285 |
fig.canvas.draw()
|
286 |
+
return PIL.Image.frombytes(
|
287 |
'RGB', fig.canvas.get_width_height(), fig.canvas.tostring_rgb())
|
|
|
|
|
288 |
|
289 |
def random_gene():
|
290 |
return np.random.default_rng().choice(gene_table.columns.values)
|
|
|
305 |
return plt_to_img(), f"{x_gene} vs. {y_gene}"
|
306 |
|
307 |
def picker(only_one_gene, x_gene, y_gene, is_normed):
|
308 |
+
plt.close('all')
|
309 |
if only_one_gene:
|
310 |
return plot_one_gene(x_gene)
|
311 |
return plot_two_genes(x_gene, y_gene, is_normed)
|