Ejemplo n.º 1
0
def radar_plot(labels, data_plots, out_fpath):

    theta = radar_factory(len(labels))

    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection="radar")

    for data_plot, color, class_num in data_plots:
        ax.plot(theta, data_plot, color=color, label="C%d" % class_num)
        ax.fill(theta, data_plot, facecolor=color, alpha=0.25)

    ax.set_varlabels(labels)
    plt.legend(frameon=False, ncol=4, bbox_to_anchor=(0.5, -0.15), loc="lower center")
    plt.savefig(out_fpath)
Ejemplo n.º 2
0
def radar_plot(labels, data_plots, out_fpath):

    theta = radar_factory(len(labels))

    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection='radar')

    for data_plot, color, class_num in data_plots:
        ax.plot(theta, data_plot, color=color, label='C%d'%class_num)
        ax.fill(theta, data_plot, facecolor=color, alpha=0.25)
        
    ax.set_varlabels(labels)
    plt.legend(frameon=False, ncol=4, bbox_to_anchor=(0.5, -0.15), 
               loc='lower center')
    plt.savefig(out_fpath)
Ejemplo n.º 3
0
def create_radar(
        spoke_labels,
        data,  # Should be a list of tuples with title and LOL data
        labels,
        save_path=os.path.join(RADAR_IMAGE_FOLDER, 'Mol0.jpg'),
        rgrids=[10, 50, 100, 500, 1000]):
    N = len(data[0][1][0])
    theta = radar_factory(N, frame='polygon')

    fig, axes = plt.subplots(figsize=(10, 10),
                             nrows=len(data),
                             ncols=1,
                             subplot_kw=dict(projection='radar'))
    fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05)

    if len(data) == 1:
        axes = np.array([[axes]])

    colors = ['b', 'r', 'g', 'm', 'y']
    colors = colors[:len(data[0][1])]
    # Plot the four cases from the example data on separate axes
    for ax, (title, case_data) in zip(axes.flatten(), data):
        ax.set_rgrids(rgrids)
        ax.set_title(title,
                     weight='bold',
                     size='medium',
                     position=(0.5, 1.1),
                     horizontalalignment='center',
                     verticalalignment='center')
        for d, color in zip(case_data, colors):
            ax.plot(theta, d, color=color)
            ax.fill(theta, d, facecolor=color, alpha=0.25)
        ax.set_varlabels(spoke_labels)

    # add legend relative to top-left plot
    ax = axes[0, 0]
    ax.legend(labels, loc=(0.9, .95), labelspacing=0.1, fontsize='large')

    # fig.text(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios',
    #          horizontalalignment='center', color='black', weight='bold',
    #          size='large')

    plt.savefig(save_path)
Ejemplo n.º 4
0
			ax.fill(theta, d, facecolor=color, alpha=0.25)

	return g,




anim = animation.FuncAnimation(fig, step, init_func=init, frames=20, interval=1000, blit=True)

plt.show()"""

interval = 20

for i in range(2000, 2020, interval):
    N = len(features)
    theta = radar_factory(N, frame='polygon')
    data = []
    for chart in sorted(charts.keys()):
        genre = []
        for feature in features:
            v = charts[chart][feature].loc['%d-01-01' % i:'%d-01-01' %
                                           (i + interval)].mean()
            genre.append(v)
        data.append(genre)
    spoke_labels = features
    fig = plt.figure()
    ax = fig.add_subplot(projection='radar')
    #fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05)

    colors = ['b', 'r', 'g', 'm', 'y', 'c', 'lime']
    # Plot the four cases from the example data on separate axes