質問編集履歴
2
[画像が分かりづらかったので削除(下に修正後の画像を追加)]
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -21,8 +21,7 @@ 
     | 
|
| 
       21 
21 
     | 
    
         
             
            plt.scatter(A[:50,0],A[:50,1],alpha=0.5)
         
     | 
| 
       22 
22 
     | 
    
         
             
            plt.show()
         
     | 
| 
       23 
23 
     | 
    
         
             
            ```
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
            [画像が分かりづらかったので削除(下に修正後の画像を追加)]
         
     | 
| 
       25 
     | 
    
         
            -
            
         
     | 
| 
       26 
25 
     | 
    
         | 
| 
       27 
26 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
       28 
27 
     | 
    
         
             
            [追記]
         
     | 
1
コードを修正しました
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -25,9 +25,68 @@ 
     | 
|
| 
       25 
25 
     | 
    
         
             
            
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
      
 28 
     | 
    
         
            +
            [追記]
         
     | 
| 
      
 29 
     | 
    
         
            +
            自分で試したところ、プロットする点を小さくすれば良いとわかったので、修正後のコードを載せておきます
         
     | 
| 
       28 
30 
     | 
    
         | 
| 
      
 31 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 32 
     | 
    
         
            +
            import matplotlib.pyplot as plt
         
     | 
| 
      
 33 
     | 
    
         
            +
            import random
         
     | 
| 
      
 34 
     | 
    
         
            +
            plt.style.use('ggplot')
         
     | 
| 
      
 35 
     | 
    
         
            +
            sample_size=1000
         
     | 
| 
      
 36 
     | 
    
         
            +
            A=np.random.random((sample_size,2))
         
     | 
| 
      
 37 
     | 
    
         
            +
            B=np.random.random((sample_size,2))
         
     | 
| 
      
 38 
     | 
    
         
            +
            # 順番1
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
            plt.figure(figsize=(2,2))
         
     | 
| 
      
 40 
     | 
    
         
            +
            plt.scatter(A[:,0],A[:,1],alpha=0.5,c='red')
         
     | 
| 
      
 41 
     | 
    
         
            +
            plt.scatter(B[:,0],B[:,1],alpha=0.5,c='blue')
         
     | 
| 
      
 42 
     | 
    
         
            +
            plt.title('fig.1')
         
     | 
| 
      
 43 
     | 
    
         
            +
            plt.show()
         
     | 
| 
       30 
44 
     | 
    
         | 
| 
      
 45 
     | 
    
         
            +
            # 順番2(反転)
         
     | 
| 
      
 46 
     | 
    
         
            +
            plt.figure(figsize=(2,2))
         
     | 
| 
      
 47 
     | 
    
         
            +
            plt.scatter(A[:,0],A[:,1],alpha=0.5,c='blue')
         
     | 
| 
      
 48 
     | 
    
         
            +
            plt.scatter(B[:,0],B[:,1],alpha=0.5,c='red')
         
     | 
| 
      
 49 
     | 
    
         
            +
            plt.title('fig.2')
         
     | 
| 
      
 50 
     | 
    
         
            +
            plt.show()
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            # 対策1
         
     | 
| 
      
 53 
     | 
    
         
            +
            # サンプル数を減らす
         
     | 
| 
      
 54 
     | 
    
         
            +
            # めんどくさい
         
     | 
| 
      
 55 
     | 
    
         
            +
            plt.figure(figsize=(2,2))
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            for i in range(2):
         
     | 
| 
      
 58 
     | 
    
         
            +
                indices=random.sample(range(sample_size),int(sample_size/10))
         
     | 
| 
      
 59 
     | 
    
         
            +
            A_part=A[indices]
         
     | 
| 
      
 60 
     | 
    
         
            +
            B_part=B[indices]
         
     | 
| 
      
 61 
     | 
    
         
            +
            plt.scatter(A_part[:,0],A_part[:,1],alpha=0.5,c='red')
         
     | 
| 
      
 62 
     | 
    
         
            +
            plt.scatter(B_part[:,0],B_part[:,1],alpha=0.5,c='blue')
         
     | 
| 
      
 63 
     | 
    
         
            +
            plt.title('fig.3')
         
     | 
| 
      
 64 
     | 
    
         
            +
            plt.show()
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            # 対策2交互にプロットする
         
     | 
| 
      
 67 
     | 
    
         
            +
            # 時間がかかりすぎる
         
     | 
| 
      
 68 
     | 
    
         
            +
            plt.figure(figsize=(2,2))
         
     | 
| 
      
 69 
     | 
    
         
            +
            for i in range(sample_size):
         
     | 
| 
      
 70 
     | 
    
         
            +
            #for i in range(int(sample_size/100)):
         
     | 
| 
      
 71 
     | 
    
         
            +
                plt.scatter(A[i,0],A[i,1],alpha=0.5,c='blue')
         
     | 
| 
      
 72 
     | 
    
         
            +
                plt.scatter(B[i,0],B[i,1],alpha=0.5,c='red')
         
     | 
| 
      
 73 
     | 
    
         
            +
            plt.title('fig.4')
         
     | 
| 
      
 74 
     | 
    
         
            +
            plt.show()
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            # 対策3 図を大きくする、点を小さくする
         
     | 
| 
      
 77 
     | 
    
         
            +
            plt.figure(figsize=(4,4))
         
     | 
| 
      
 78 
     | 
    
         
            +
            plt.scatter(A[:,0],A[:,1],alpha=0.5,c='blue',s=5)
         
     | 
| 
      
 79 
     | 
    
         
            +
            plt.scatter(B[:,0],B[:,1],alpha=0.5,c='red',s=5)
         
     | 
| 
      
 80 
     | 
    
         
            +
            plt.title('fig.5')
         
     | 
| 
      
 81 
     | 
    
         
            +
            plt.show()
         
     | 
| 
      
 82 
     | 
    
         
            +
            ```
         
     | 
| 
      
 83 
     | 
    
         
            +
            
         
     | 
| 
      
 84 
     | 
    
         
            +
            
         
     | 
| 
      
 85 
     | 
    
         
            +
            
         
     | 
| 
      
 86 
     | 
    
         
            +
            
         
     | 
| 
      
 87 
     | 
    
         
            +
            
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       31 
90 
     | 
    
         
             
            ### 補足情報(FW/ツールのバージョンなど)
         
     | 
| 
       32 
91 
     | 
    
         | 
| 
       33 
92 
     | 
    
         
             
            ここにより詳細な情報を記載してください。
         
     |