How to use the matplotlib.pyplot.title function in matplotlib

To help you get started, we’ve selected a few matplotlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapsme / omim / tools / python / transit / transit_graph_generator.py View on Github external
def show_color_maching_table(self, title, colors_ref_table):
        import matplotlib.pyplot as plt
        import matplotlib.patches as patches
        fig = plt.figure()
        ax = fig.add_subplot(111, aspect='equal')
        plt.title(title)
        sz = 1.0 / (2.0 * len(self.matched_colors))
        delta_y = sz * 0.5
        for c in self.matched_colors:
            tokens = c.split('/')
            if len(tokens[1]) == 0:
                tokens[1] = tokens[0]
            ax.add_patch(patches.Rectangle((sz, delta_y), sz, sz, facecolor="#" + tokens[0], edgecolor="#" + tokens[1]))
            rect_title = tokens[0]
            if tokens[0] != tokens[1]:
                rect_title += "/" + tokens[1]
            ax.text(2.5 * sz, delta_y, rect_title + " -> ")
            ref_color = colors_ref_table[self.matched_colors[c]]
            ax.add_patch(patches.Rectangle((0.3 + sz, delta_y), sz, sz, facecolor="#" + ref_color))
            ax.text(0.3 + 2.5 * sz, delta_y, ref_color + " (" + self.matched_colors[c] + ")")
            delta_y += sz * 2.0
        plt.show()
github istellartech / OpenGoddard / examples / 08_Rocket_Ascent_Polar_SSTO.py View on Github external
plt.ylabel("Velocity [m/s]")
plt.legend(loc="best")
if(flag_savefig): plt.savefig(savefig_file + "velocity" + ".png")

plt.figure()
plt.title("Mass")
plt.plot(time, m, marker="o", label="Mass")
for line in prob.time_knots():
    plt.axvline(line, color="k", alpha=0.5)
plt.grid()
plt.xlabel("time [s]")
plt.ylabel("Mass [kg]")
if(flag_savefig): plt.savefig(savefig_file + "mass" + ".png")

plt.figure()
plt.title("Acceleration")
plt.plot(time, a_r, marker="o", label="Acc r")
plt.plot(time, a_t, marker="o", label="Acc t")
plt.plot(time, a_mag, marker="o", label="Acc")
for line in prob.time_knots():
    plt.axvline(line, color="k", alpha=0.5)
plt.grid()
plt.xlabel("time [s]")
plt.ylabel("Acceleration [m/s2]")
if(flag_savefig): plt.savefig(savefig_file + "acceleration" + ".png")

plt.figure()
plt.title("Thrust profile")
plt.plot(time, Tr / 1000, marker="o", label="Tr")
plt.plot(time, Tt / 1000, marker="o", label="Tt")
plt.plot(time, T / 1000, marker="o", label="Thrust")
plt.plot(time, Dr / 1000, marker="o", label="Dr")
github CalebBell / thermo / thermo / utils.py View on Github external
if self.test_method_validity_P(T, P, method_P):
                        try:
                            p = self.calculate_P(T, P, method_P)
                            if self.test_property_validity(p):
                                properties.append(p)
                                Ts2.append(T)
                        except:
                            pass
                plt.plot(Ts2, properties, label=method_P)
            else:
                properties = [self.calculate_P(T, P, method_P) for T in Ts]
                plt.plot(Ts, properties, label=method_P)
        plt.legend()
        plt.ylabel(self.name + ', ' + self.units)
        plt.xlabel('Temperature, K')
        plt.title(self.name + ' of ' + self.CASRN)
        plt.show()
github mpatacchiola / dissecting-reinforcement-learning / src / 9 / drone-visual-landing / random_agent_drone_landing.py View on Github external
+ "-" + str(my_drone.position_z) + "-" + str(my_drone.position_r))
    print("Action: " + str(action) + " (" + my_drone.actions_dict[action] + ")")
    print("Image shape: " + str(observation[0].shape))
    print("")
    cumulated_reward += reward
    if done: break
print("Finished after: " + str(step+1) + " steps")
print("Cumulated Reward: " + str(cumulated_reward))
print("Rendering GIF, please wait...")
my_drone.render(file_path='./drone_landing.gif', mode='gif')
for i in range(len(observation)): observation[i] = np.pad(observation[i], ((3, 3), (3, 3)), 'constant', constant_values=0)
img = (np.concatenate(observation, axis=1)*255.0).astype(np.uint8)
plt.title("Last observation (4 images)")
imgplot = plt.imshow(img, cmap='gray',vmin=0,vmax=255)
plt.show()
plt.title("World")
imgplot = plt.imshow(my_drone.floor, cmap='gray',vmin=0,vmax=255)
plt.show()
print("Complete!")
github scikit-learn-contrib / imbalanced-learn / examples / under-sampling / plot_neighbourhood_cleaning_rule.py View on Github external
plt.scatter(X_res_vis[~idx_class_0, 0], X_res_vis[~idx_class_0, 1],
            alpha=.8, label='Class #1')
plt.scatter(X_vis[idx_samples_removed, 0], X_vis[idx_samples_removed, 1],
            alpha=.8, label='Removed samples')

# make nice plotting
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
ax.spines['left'].set_position(('outward', 10))
ax.spines['bottom'].set_position(('outward', 10))
ax.set_xlim([-6, 6])
ax.set_ylim([-6, 6])

plt.title('Under-sampling using neighbourhood cleaning rule')
plt.legend()
plt.tight_layout()
plt.show()
github istellartech / OpenGoddard / examples / 06_Rocket_Ascent_SingleStage.py View on Github external
g = obj.GMe / R**2

# ------------------------
# Visualizetion
plt.figure()
plt.title("Altitude profile")
plt.plot(time, (R - obj.Re)/1000, marker="o", label="Altitude")
for line in prob.time_knots():
    plt.axvline(line, color="k", alpha=0.5)
plt.grid()
plt.xlabel("time [s]")
plt.ylabel("Altitude [km]")
if(flag_savefig): plt.savefig(savefig_file + "altitude" + ".png")

plt.figure()
plt.title("Velocity")
plt.plot(time, v, marker="o", label="Velocity")
for line in prob.time_knots():
    plt.axvline(line, color="k", alpha=0.5)
plt.grid()
plt.xlabel("time [s]")
plt.ylabel("Velocity [m/s]")
if(flag_savefig): plt.savefig(savefig_file + "velocity" + ".png")

plt.figure()
plt.title("Mass")
plt.plot(time, m, marker="o", label="Mass")
for line in prob.time_knots():
    plt.axvline(line, color="k", alpha=0.5)
plt.grid()
plt.xlabel("time [s]")
plt.ylabel("Mass [kg]")
github ignamv / ngspyce / examples / npn / npn.py View on Github external
# Load simulation results into numpy arrays
vb, vc, Ivcc = map(ngspyce.vector, ['Vb', 'Vc', 'I(Vcc)'])

# Correct the sign for collector current
ic = -Ivcc

plt.figure()
# Plot one line per base voltage
series = np.unique(vb)
for _vb in series:
    plt.plot(vc[vb == _vb], ic[vb == _vb], '-',
             label='Vb = {:.1f}'.format(_vb))

plt.legend(loc='center right')
plt.title('Output characteristics for BC337')
plt.xlabel('Collector-emitter voltage [V]')
plt.ylabel('Collector current [A]')
plt.savefig('bc337.png')
plt.show()
github Qiskit / qiskit-aqua / qiskit / ml / datasets / breast_cancer.py View on Github external
sample_test = minmax_scale.transform(sample_test)

    # Pick training size number of samples from each distro
    training_input = {key: (sample_train[label_train == k, :])[:training_size]
                      for k, key in enumerate(class_labels)}
    test_input = {key: (sample_test[label_test == k, :])[:test_size]
                  for k, key in enumerate(class_labels)}

    if plot_data:
        if not HAS_MATPLOTLIB:
            raise NameError('Matplotlib not installed. Plase install it before plotting')
        for k in range(0, 2):
            plt.scatter(sample_train[label_train == k, 0][:training_size],
                        sample_train[label_train == k, 1][:training_size])

        plt.title("PCA dim. reduced Breast cancer dataset")
        plt.show()

    return sample_train, training_input, test_input, class_labels
github omidm / nimbus / ec2 / obsolete / water_multiple / output-feb11-scale256-experiment1 / print_sum.py View on Github external
for i in range(0, len(Data)):
    p = plot_bar(Data[i], ind, bottom, Colors[i], Hatch[i], True)
    Parts.append(p[0])

bottom = [0]
NewColors = [Colors[0], Colors[1], Colors[3]]
for i in range(0, len(PhysbamData[0])):
    p = plot_bar([PhysbamData[1][i]],
                 np.array([WN+1]),
                 bottom, NewColors[i], Hatch[i], True)
    Parts.append(p[0])

title  = 'PhysBAM Water Simulation Size 256 Cube, 64 uniform partitions, 100 projection iteration\n'
title += '8 c3.2xlarge EC2 workers each with 8 threads, c3.4xlarge controller with 8 assigning threads\n'
title += 'worker templates disabled'
plt.title(title)

xticks = []
for i in range(1, WN + 1):
  xticks.append('W' + str(i) + ' (old/new)')
xticks.append("mean (old/new)")
xticks.append("PhysBAM\n(worst in 6 samples/average)")
ind = np.arange(N+1)
plt.xticks(ind+width/2., xticks )
plt.ylabel('Time (seconds)')
plt.xlim(-0.5, N+1)
plt.ylim(0, 40)

plt.legend(reversed(Parts), reversed(Legends))

plt.show()
github SubstraFoundation / distributed-learning-contributivity / multi_partner_learning.py View on Github external
plt.xlabel("Epoch")
        plt.savefig(self.save_folder / "graphs/federated_training_loss.png")
        plt.close()

        plt.figure()
        plt.plot(self.score_matrix_collective_models[: self.epoch_index + 1, self.minibatch_count])
        plt.ylabel("Accuracy")
        plt.xlabel("Epoch")
        # plt.yscale('log')
        plt.ylim([0, 1])
        plt.savefig(self.save_folder / "graphs/federated_training_acc.png")
        plt.close()

        plt.figure()
        plt.plot(self.score_matrix_per_partner[: self.epoch_index + 1, self.minibatch_count - 1, ])
        plt.title("Model accuracy")
        plt.ylabel("Accuracy")
        plt.xlabel("Epoch")
        plt.legend(["partner " + str(i) for i in range(self.partners_count)])
        # plt.yscale('log')
        plt.ylim([0, 1])
        plt.savefig(self.save_folder / "graphs/all_partners.png")
        plt.close()