![]() How to create a 2d histogram with matplotlib ? ![]() Plot the 2d histogram: plt.hist2d(x,y) plt.title("How to plot a 2d histogram with matplotlib ?") plt.savefig("histogram_2d_01.png", bbox_inches='tight') plt.close() There is the numpy function loadtxt(): x, y = np.loadtxt("data.txt",unpack=True) from numpy import c_ import numpy as np import matplotlib.pyplot as plt import random n = 100000 x = np.random.standard_normal(n) y = 3.0 * x + 2.0 * np.random.standard_normal(n) ![]() ![]() To create a 2d histogram in python there are several solutions: for example there is the matplotlib function hist2d. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |