Beispiel #1
0
def plot_dues_line(x, y, goal):
    color = 'green'
    style.use('ggplot')

    fig = plt.figure(figsize=(15, 8))
    ax = fig.add_subplot(111)
    ax.plot(x, y, label=f'{DUES_CATEGORY}', marker='.', color=color)

    ax.plot(x, goal, label=f'{GOAL_LABEL}', linestyle='--', color=color)

    mondays = WeekdayLocator(MONDAY, interval=4)
    weeks_format = DateFormatter('%-m/%-d/%y')
    ax.xaxis.set_major_locator(mondays)
    ax.xaxis.set_major_formatter(weeks_format)

    ax.set_ylim(bottom=0)

    plt.title(f'{DUES_CATEGORY}')
    plt.xlabel('Date')
    plt.ylabel(f'$')

    plt.legend()

    file_name = f'{DUES_CATEGORY}_line.png'
    full_path = get_file_path(DUES_CATEGORY, file_name)

    plt.savefig(full_path, bbox_inches='tight')
    plt.close(fig)
def plot(data, date):
    color = 'green'
    style.use('ggplot')

    fig = plt.figure(figsize=(15,8))
    ax = fig.add_subplot(111)
    counts, bins, patches = ax.hist(
        data,
        bins=10,
        rwidth=.9,
        color=color
    )

    max_count = max(counts)
    ax.set_xticks(bins)
    ax.set_yticks(np.arange(0, max_count+1, 4))

    plt.title(f'{DUES_CATEGORY} Distribution {date}')
    plt.xlabel(f'{DUES_CATEGORY} ($)')
    plt.ylabel(f'FOI Count')

    file_name = f'{DUES_CATEGORY}_histogram.png'
    full_path = get_file_path(DUES_CATEGORY, file_name)

    plt.savefig(full_path, bbox_inches='tight')
    plt.close(fig)
def plot(data, date):
    style.use('ggplot')

    fig = plt.figure(figsize=(15, 8))
    ax = fig.add_subplot(111)
    counts, bins, patches = ax.hist(data, bins=10, rwidth=.9)

    ax.set_xticks(bins)

    plt.title(f'{FCN_CATEGORY} Distribution {date}')
    plt.xlabel(f'{FCN_CATEGORY}')
    plt.ylabel(f'FOI Count')

    file_name = f'{FCN_CATEGORY}_histogram.png'
    full_path = get_file_path(FCN_CATEGORY, file_name)

    plt.savefig(full_path, bbox_inches='tight')
    plt.close(fig)
Beispiel #4
0
def plot(x_vals, y_vals, date):
    style.use('ggplot')

    x_pos = np.arange(len(x_vals))

    fig = plt.figure(figsize=(10, 8))
    # ax = fig.add_subplot(111)
    # ax = data.plot(kind='barh', figsize=(15, 8), legend=True, fontsize=12)

    plt.barh(x_pos, y_vals)

    plt.axvline(x=50)
    plt.text(50.5, 8, 'Minimum', color='red')

    plt.axvline(x=100, linestyle='--')
    plt.text(100.5, 8, 'Goal', color='red')

    for i, val in enumerate(y_vals):
        color = 'white'

        if (val > 99):
            x = val - 15
        elif (val > 5 and val < 100):
            x = val - 10
        elif (val < 6):
            x = 5
            color = 'red'

        plt.text(x, i, str(val), color=color, fontweight='bold', va='center')

    plt.yticks(x_pos, x_vals)

    plt.tight_layout(pad=2.3)

    plt.title(f'Tampa FCN {date}')
    plt.xlabel(f'{FCN_CATEGORY}')
    plt.ylabel(f'FOI')

    file_name = f'{FCN_CATEGORY}_bar.png'
    full_path = get_file_path(FCN_CATEGORY, file_name)

    plt.savefig(full_path, bbox_inches='tight')
    plt.close()
def plot_fcn_line(x, y, goal):
    color = 'goldenrod'
    style.use('ggplot')

    fig = plt.figure(figsize=(15,8))
    ax = fig.add_subplot(111)
    ax.plot(
        x, y, 
        label=f'{FCN_CATEGORY}', 
        marker='.',
        color=color
    )

    ax.plot(
        x, goal, 
        label=f'{GOAL_LABEL}', 
        linestyle='--',
        color=color
    )

    sundays = WeekdayLocator(SUNDAY, interval=4)
    weeks_format  = DateFormatter('%-m/%-d/%y')
    ax.xaxis.set_major_locator(sundays)
    ax.xaxis.set_major_formatter(weeks_format)

    ax.set_ylim(bottom=0)

    plt.title(f'Bro {y.name} {FCN_CATEGORY}')
    plt.xlabel(X_LABEL)
    plt.ylabel(f'{FCN_CATEGORY}')

    file_name = f'{y.name}_{FCN_CATEGORY}_line.png'
    full_path = get_file_path(FCN_CATEGORY, file_name)

    plt.savefig(full_path, bbox_inches='tight')
    plt.close(fig)