Exemple #1
0
def plotData(x, *y):
	colors = ["b","g","r","c","m","y","k"]

	plt.xlabel("timestamp")
	plt.ylabel("values")
	for i in range(len(y)):
		plt.plot(x, y[i], colors[i%7])
	plt.show()
Exemple #2
0
def plot_results(a_plot_list, b_plot_list, k_plot_list, n):
    # plotting the results of the two algorithms against k value and runtime
    plt.plot(k_plot_list, a_plot_list, "r-")
    plt.plot(k_plot_list, b_plot_list, "k-")
    plt.xlabel("Searching Set Size (k value)")
    plt.ylabel("Time (seconds)")
    plt.title(str("Time complexity with data set of size n=" + str(n)))
    red = mpatches.Patch(color="red", label="Linear Search")
    black = mpatches.Patch(color="black", label="Binary Search")
    plt.legend(handles=[red, black])
    plt.grid(True)
    plt.show()
Exemple #3
0
import matplotlib.plot as p
import math

x = [i/500. for i in range(1000)]
f = [math.exp(-x_i) for x_i in x]
r = [x_i * f_i for x_i, f_i in zip(x, f)]
p.plot(x, r)
p.grid()
p.show()
Exemple #4
0
from matplotlib import plot as plt

x = range(2, 26, 2)
y = [1, 2, 3, 4, 5, 6, 7, 8, 20, 12, 12, 11]


plt.plot(x, y)
plt.show()
Exemple #5
0
import matplotlib.plot as p
import math

x = [i / 500. for i in range(1000)]
f = [math.exp(-x_i) for x_i in x]
r = [x_i * f_i for x_i, f_i in zip(x, f)]
p.plot(x, r)
p.grid()
p.show()