Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. from matplotlib import pyplot as plt
  2.  
  3. fractions = range(1, 16)
  4. mcgs = [0,0,0,0,0,190,145,10,0,0,0,0,0,0,0]
  5. dpms = [0,0,0,0,0,290,390,0,0,0,0,5,20,80,350]
  6.  
  7. #check lists for length
  8. for list in [dpms, mcgs]:
  9. assert len(list) == len(fractions), "lists should be same length"
  10.  
  11.  
  12. fig, ax1 = plt.subplots(figsize=(6,4))
  13. ax2 = ax1.twinx()
  14.  
  15. def my_plot(ax, fractions, alist, color = "red", ylabel = "ylabel"):
  16. ax.scatter(fractions, alist, color=color, label=ylabel, alpha=0.5)
  17. ax.plot(fractions, alist, color=color, ls=":")
  18. ax.set_ylabel(ylabel)
  19.  
  20. my_plot(ax1,
  21. fractions,
  22. dpms,
  23. ylabel=r"Total Radioactivity count (DPM) $10^{3}$",
  24. color="orange")
  25.  
  26. my_plot(ax2,
  27. fractions,
  28. mcgs,
  29. ylabel= r"Total Protein $\mu$g",
  30. color="blue")
  31.  
  32. fig.legend(bbox_to_anchor=(1, 1), loc='upper left', borderaxespad=0.)
  33. ax1.set_title(r"Incorporation of ${}^{14}$C into X")
  34. ax1.set_ylim(0, 450)
  35. ax2.set_ylim(0, 200)
  36. ax1.set_xlabel("fraction")
  37.  
  38. fig.tight_layout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement