Save to file#

This example shows how to save a plot to a file.

import numpy as np
import marsilea as ma

data = np.random.randint(0, 10, (10, 10))

To save a plot to a file, use the save method.

h = ma.Heatmap(data, width=3, height=3)
h.save("plot.png")
plot save

You can also save the plot use the matplotlib.pyplot.savefig().

import matplotlib.pyplot as plt

h = ma.Heatmap(data, width=3, height=3)
h.render()

plt.savefig("plot.pdf", bbox_inches="tight")
plot save

Total running time of the script: (0 minutes 0.516 seconds)

Gallery generated by Sphinx-Gallery