Guest User

Untitled

a guest
Sep 24th, 2020
244
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     import numpy as np
  2.     import matplotlib.pyplot as plt
  3.  
  4.     def dots(nmax, a=None, rot=None):
  5.         r3o2, to_rads = np.sqrt(3)/2., np.pi/180.
  6.         if a == None: a = 1.0
  7.         if rot == None: rot=0.0
  8.         i = np.arange(-nmax, nmax+1)
  9.         I, J = np.meshgrid(i, i)
  10.         keep = np.abs(I+J) <= nmax
  11.         I, J = [thing[keep].flatten() for thing in (I, J)]
  12.         x, y = a*(I + 0.5*J), a*r3o2*J
  13.         c, s = [f(to_rads*rot) for f in (np.cos, np.sin)]
  14.         return x*c - y*s, y*c + x*s
  15.        
  16.     rat = np.sqrt(13./7)
  17.  
  18.     A = dots(12)
  19.     B, C = dots(10, rat, 5.209), dots(10, rat, 11.218)
  20.  
  21.     plt.figure(figsize=[11, 7])
  22.     plt.subplot(1, 2, 1)
  23.     plt.scatter([0], [0], s=200, c='black', edgecolor='none')
  24.     plt.scatter(A[0], A[1], s=100, c='none', edgecolor='black')
  25.     plt.scatter(B[0], B[1], s=30, c='black', edgecolor='none')
  26.     # plt.arrow(9.2, 9.5, -1, -1, color='red', width=0.15)
  27.     plt.xlim(-0.5, 14)
  28.     plt.ylim(-0.5, 14)
  29.     plt.gca().set_aspect('equal')
  30.     plt.title('(6, 5) <-> (5, 3) (5.209 deg)', fontsize=12)
  31.  
  32.     plt.subplot(1, 2, 2)
  33.     plt.scatter([0], [0], s=200, c='black', edgecolor='none')
  34.     plt.scatter(A[0], A[1], s=100, c='none', edgecolor='black')
  35.     plt.scatter(C[0], C[1], s=30, c='black', edgecolor='none')
  36.     # plt.arrow(9.85, 7.0, -1, -1, color='red', width=0.15)
  37.     plt.xlim(-0.5, 14)
  38.     plt.ylim(-0.5, 14)
  39.     plt.gca().set_aspect('equal')
  40.     plt.title('(5, 6) <-> (5, 3) (11.218 deg)', fontsize=12)
  41.  
  42.     plt.show()
  43.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×