<commit_before>import numpy as np
import matplotlib.pyplot as plt
from showfig import showfig

def hist2d(x, y, bins=10, aspect="auto", plot=True, fig=None, range=None):
	"""Creates a 2D histogram of data."""

	h,xe,ye=np.histogram2d(x,y,bins=bins,range=range)
	extent=[xe[0],xe[-1],ye[-1],ye[0]]
	# fig=plt.figure()
	if plot:
		if ( fig==None ):
			fig=plt.gcf()
		ax=fig.gca()
		ax.clear()
		img=ax.imshow(h.transpose(),extent=extent,interpolation="none",aspect=aspect)
		plt.colorbar(img)
		showfig(fig,aspect)
	return h,extent
<commit_msg>Added labels to hist2d.<commit_after>import numpy as np
import matplotlib.pyplot as plt
from showfig import showfig
from addlabel import addlabel

def hist2d(x, y, bins=10, labels=None, aspect="auto", plot=True, fig=None, range=None):
	"""Creates a 2D histogram of data."""

	h,xe,ye=np.histogram2d(x,y,bins=bins,range=range)
	extent=[xe[0],xe[-1],ye[-1],ye[0]]
	# fig=plt.figure()
	if plot:
		if ( fig==None ):
			fig=plt.gcf()
		ax=fig.gca()
		ax.clear()
		img=ax.imshow(h.transpose(),extent=extent,interpolation="none",aspect=aspect)
		plt.colorbar(img)
		if ( labels != None ):
			addlabel(labels[0],labels[1],labels[2])

		showfig(fig,aspect)
	return h,extent

{'fraction_non_alphanumeric': 0.1771523178807947, 'fraction_numerical': 0.018211920529801324, 'mean_word_length': 5.679558011049724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '438406', 'n_tokens_mistral': 530, 'n_tokens_neox': 493, 'n_words': 94}