Skip to content

Instantly share code, notes, and snippets.

@wei2912
Forked from fishnsotong/plotgraph.py
Last active January 3, 2017 10:44
Show Gist options
  • Save wei2912/ac25ba3ebc0574ebad5bd36b7c2e2016 to your computer and use it in GitHub Desktop.
Save wei2912/ac25ba3ebc0574ebad5bd36b7c2e2016 to your computer and use it in GitHub Desktop.
Making a scatter plot in python by importing data from a csv file.
import numpy as np
import matplotlib.pyplot as plt
# importing data from csv file
xs, ys, zs = np.loadtxt("data.txt", unpack=True, delimiter=",", dtype=float, skiprows=0)
# labels
plt.xlabel("No. of PT-CT Pairs per Distinguisher")
plt.ylabel("lg2(T(N))")
plt.title("Lower Bound on Time Complexity of Single and Double Distinguisher Attack")
# plotting
plt.plot(xs, ys, color='blue', label='Single Distinguisher Attack', linestyle='-')
plt.plot(xs, zs, color='rede', label='Double Distinguisher Attack', linestyle='-')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment