def plot_data_set(dataset_name): data_set = pickle.load(open('utils/data_sets.pickle', 'rb'), encoding='latin1')[dataset_name] fig = plt.figure() ax = fig.add_subplot(111) ac.hide_top_and_right_axis(ax) # plt.axis('off') ac.plot_data(data_set, ax) ac.save_plot(fig)
def create_iris_figure(): from sklearn import datasets iris = datasets.load_iris() data = np.append(iris.data.T[0:2], np.array([iris.target]), axis=0) fig = plt.figure() ax = fig.add_subplot(111) plt.axis('off') ac.plot_data(data, ax) ac.save_plot(fig)
def plot_all_data_sets(): data_sets = pickle.load(open('../data_sets.pickle', 'rb'), encoding='latin1') for key in data_sets: data = data_sets[key] fig = plt.figure() ax = fig.add_subplot(111) ac.hide_top_and_right_axis(ax) # plt.axis('off') ac.plot_data(data, ax) ac.save_plot(fig)
def plot_points(): blue = np.array([[1.7, 1.2, .9, .7, 2.3, 1.75, 2.7, 3.3, 3.1], [-0.23, 0.2, 1.05, 1.87, 0.15, 2.08, -.3, 1.1, 2.2], [.0, .0, .0, .0, .0, .0, .0, .0, .0]]) red = np.array([[2.26, 1.8, 2.3], [1.38, 1.15, 0.8], [1, 1, 1]]) data = np.concatenate((red, blue), axis=1) ax = plt.subplot(111) ac.plot_data(data, ax) plt.axis('off') ac.save_plot() plt.savefig('points.svg', bbox_inches='tight')
def np_list_to_csv_string(npl): return ",".join(list(map(lambda f: "{:.4f}".format(f), npl))) csv = [] for arr in mean_results: csv.append(np_list_to_csv_string(arr)) utils.save_object(mean_results, SAVE_FOLDER, 'results') utils.save_string_to_file("\n".join(csv), SAVE_FOLDER, 'results.csv') utils.save_dict(CLASSIFIER_CONFIG, SAVE_FOLDER, 'config.json') data = np.array(mean_results) x = range(data.shape[1]) fig, ax = plt.subplots() plotter.hide_top_and_right_axis(ax) ax.yaxis.grid(color='gray') ax.set_xlabel('Time (seconds)') ax.set_ylabel('Best polygon solution') ax.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k', 'r', 'g', 'b'])) lines = [] for i in range(len(configurations)): lines.append(ax.plot(x, data[i], label=labels[i])) plt.legend(labels, loc='lower right') plotter.save_plot(fig, SAVE_FOLDER, 'results') # plt.show() #fig1.savefig('fig1.eps')