<commit_before>from __future__ import division
# python libs
import sys
# 3rd party
importerrors = []
try:
    import statsmodels.nonparametric.kde as kde
except ImportError as ie:
    importerrors.append(ie)
try:
    import matplotlib as mpl
except ImportError as ie:
    importerrors.append(ie)

if len(importerrors) != 0:
    for item in importerrors:
        print 'Import Error:', item
    sys.exit()

from matplotlib.ticker import FuncFormatter, MaxNLocator, MultipleLocator
import matplotlib.pyplot as plt


def plot_kde(data, ax, title=None, color='r', fill_bt=True):
    """
    Plot a smoothed (by kernel density estimate) histogram.
    :type data: numpy array
    :param data: An array containing the data to be plotted

    :type ax: matplotlib.Axes
    :param ax: The Axes object to draw to

    :type title: str
    :param title: The plot title

    :type color: str
    :param color: The color of the histogram line and fill. Note that the fill
                  will be plotted with an alpha of 0.35.

    :type fill_bt: bool
    :param fill_bt: Specify whether to fill the area beneath the histogram line
    """
    e = kde.KDEUnivariate(data)
    e.fit()
    ax.plot(e.support, e.density, color=color, alpha=0.9, linewidth=2.25)
    if fill_bt:
        ax.fill_between(e.support, e.density, alpha=.35, zorder=1,
                        antialiased=True, color=color)
    if title is not None:
        t = ax.set_title(title)
        t.set_y(1.05)

def ggplot2_style(ax):<commit_msg>Updates KDE graph to fix known dtype issue<commit_after>from __future__ import division
# python libs
import sys
# 3rd party
importerrors = []
try:
    import numpy as np
except ImportError as ie:
    importerrors.append(ie)
try:
    import statsmodels.nonparametric.kde as kde
except ImportError as ie:
    importerrors.append(ie)
try:
    import matplotlib as mpl
except ImportError as ie:
    importerrors.append(ie)

if len(importerrors) != 0:
    for item in importerrors:
        print 'Import Error:', item
    sys.exit()

from matplotlib.ticker import FuncFormatter, MaxNLocator, MultipleLocator
import matplotlib.pyplot as plt


def plot_kde(data, ax, title=None, color='r', fill_bt=True):
    """
    Plot a smoothed (by kernel density estimate) histogram.
    :type data: numpy array
    :param data: An array containing the data to be plotted

    :type ax: matplotlib.Axes
    :param ax: The Axes object to draw to

    :type title: str
    :param title: The plot title

    :type color: str
    :param color: The color of the histogram line and fill. Note that the fill
                  will be plotted with an alpha of 0.35.

    :type fill_bt: bool
    :param fill_bt: Specify whether to fill the area beneath the histogram line
    """
    if isinstance(data, list):
        data = np.asarray(data)
    e = kde.KDEUnivariate(data.astype(np.float))
    e.fit()
    ax.plot(e.support, e.density, color=color, alpha=0.9, linewidth=2.25)
    if fill_bt:
        ax.fill_between(e.support, e.density, alpha=.35, zorder=1,
                        antialiased=True, color=color)
    if title is not None:
        t = ax.set_title(title)
        t.set_y(1.05)

def ggplot2_style(ax):
{'fraction_non_alphanumeric': 0.08732394366197183, 'fraction_numerical': 0.010641627543035994, 'mean_word_length': 2.965260545905707, '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': '6925998', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1017, 'n_words': 353}