mpld3 решает это для меня. EDIT (CODE ADDED):
import matplotlib.pyplot as plt
import numpy as np
import mpld3
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))
N = 100
scatter = ax.scatter(np.random.normal(size=N),
np.random.normal(size=N),
c=np.random.random(size=N),
s=1000 * np.random.random(size=N),
alpha=0.3,
cmap=plt.cm.jet)
ax.grid(color='white', linestyle='solid')
ax.set_title("Scatter Plot (with tooltips!)", size=20)
labels = ['point {0}'.format(i + 1) for i in range(N)]
tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
mpld3.plugins.connect(fig, tooltip)
mpld3.show()
Вы можете проверить пример
Нашли решение этой проблемы; преобразовать файл в Base64, сохранить его в переменной сеанса, а при отправке формы извлечь его из сеанса:
//convert to Base64
System.IO.Stream fileStream = model.PersonPhotoFile.InputStream;
Byte[] fileToByte = new Byte[model.PersonPhotoFile.ContentLength];
model.PersonPhotoFile.InputStream.Position = 0;
model.PersonPhotoFile.InputStream.Read(fileToByte, 0, model.PersonPhotoFile.ContentLength);
string base64stringPhoto = Convert.ToBase64String(fileToByte);
fileStream.Close();
//convert from Base64 and write to file
Byte[] fileFromBytes = Convert.FromBase64String(base64stringPhoto);
System.IO.File.WriteAllBytes("D:\\Temp\\temp_from_base64.jpg", fileFromBytes);