Matplotlib
rcParams
plt.rcParams['figure.figsize'] = [12, 8] #plt.rcParams.update(plt.rcParamsDefault)
Plot
plt.figure(figsize = (12, 8)) plt.plot(x, y, 'o') plt.errorbar(x, y, xerr=(xl, xh), fmt='o', color='black', ecolor='red', capsize=5) plt.xlim(0, 1) plt.xticks([]) plt.yticks([]) plt.xticks(np.arange(0, 1, 0.1)) plt.xlabel('X') plt.grid() plt.legend() plt.savefig('figure.png', bbox_inches='tight') plt.show()
plt.imshow(img, cmap='gray') plt.colorbar()
Plot (Artist)
fig, ax = plt.subplots(figsize = (8, 6)) ax.plot(x, y, marker="o", linestyle="-", label="1") ax.plot(x, y, marker="s", linestyle="-", label="2") ax.set_xlim(0.1, 100) ax.set_ylim(0.1, 100) ax.set_xticks(np.arange(0.1, 100, 1.0)) ax.set_yticks(np.arange(0.1, 100, 1.0)) ax.set_xscale("log") ax.set_yscale("log") ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_title("Title") ax.legend() ax.grid(linestyle='--') plt.savefig('figure.png', bbox_inches='tight') plt.show()
im = ax.imshow(img, cmap='gray') fig.colorbar(im, ax=ax)
Memory Release
https://qiita.com/Masahiro_T/items/bdd0482a8efd84cdd270
https://qiita.com/Masahiro_T/items/037c118c9dd26450f8c8
https://qiita.com/uz29/items/dd2e4c4fb2acaee5a93d
plt.clf() plt.close()
## In case of using plt.tight_layout() and/or plt.savefig() plt.cla()
References
https://qiita.com/skotaro/items/08dc0b8c5704c94eafb9
https://qiita.com/nkay/items/d1eb91e33b9d6469ef51
Acknowledgments
Daiphys is a professional-service company for research and development of leading-edge technologies in physics and engineering.
Get started accelerating your business through our deep expertise in R&D with AI, quantum computing, and space development; please get in touch with Daiphys today!
Daiphys Technologies LLC - https://www.daiphys.com/