You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating a project similar to chaquopy-matplotlib. Bitmap is null while image is getting displayed from the byte array returned from python script
val bytes = module.callAttr("plot",
findViewById<EditText>(R.id.etX).text.toString(),
findViewById<EditText>(R.id.etY).text.toString())
.toJava(ByteArray::class.java)
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
findViewById<ImageView>(R.id.imageView).setImageBitmap(bitmap)
import io
import matplotlib.pyplot as plt
def plot(x, y):
xa = [float(word) for word in x.split()]
ya = [float(word) for word in y.split()]
fig, ax = plt.subplots()
ax.plot(xa, ya)
f = io.BytesIO()
plt.savefig(f, format="png")
return f.getvalue()
The text was updated successfully, but these errors were encountered:
I am creating a project similar to chaquopy-matplotlib. Bitmap is null while image is getting displayed from the byte array returned from python script
The text was updated successfully, but these errors were encountered: