-
Notifications
You must be signed in to change notification settings - Fork 476
Open
Description
I tried to use the get_png_data method to save the figure as a png programmatically, but it has has no effect. No png is created.
https://bqplot.github.io/bqplot/api/figure/?h=get_p#bqplot.Figure.get_png_data
Relevant issue: #963
import bqplot.pyplot as plt
import numpy as np
# Create some example data
x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x)
# Plot the data
fig = plt.figure(title='Sine Wave')
plt.plot(x, y)
plt.show()
# Define a callback function to handle the PNG data
def save_png_data(png_data):
with open('plot.png', 'wb') as f:
f.write(png_data)
print("PNG data saved to plot.png")
# Get the plot as PNG data and save it
fig.get_png_data(save_png_data, scale=2)Metadata
Metadata
Assignees
Labels
No labels