Merge branch 'dev-anish' of http://gitea.lcepl.org/pjpatil12/Comparison_Project into dev-anish
This commit is contained in:
10
app/utils/plot_utils.py
Normal file
10
app/utils/plot_utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import base64
|
||||
from io import BytesIO
|
||||
import matplotlib
|
||||
matplotlib.use("Agg")
|
||||
|
||||
def plot_to_base64(plt):
|
||||
img = BytesIO()
|
||||
plt.savefig(img, format="png", bbox_inches="tight")
|
||||
img.seek(0)
|
||||
return base64.b64encode(img.read()).decode("utf-8")
|
||||
Reference in New Issue
Block a user