@@ -108,7 +108,9 @@ def yield_counts_by_proteome_count(self, count_type):
108108 self .proteome_counts_by_colour [colour ].append (proteome_count )
109109 if count_type == "absolute" :
110110 y = [self .counts_by_cluster_size_by_proteome_counts [proteome_count ][cluster_size ] + y_b for cluster_size , y_b in zip (sorted (self .counts_by_cluster_size_by_proteome_counts [proteome_count ]), y_bottom )]
111+ #filled = self.interpolate_gaps(y, 1)
111112 yield proteome_count , x , y , y_bottom , colour
113+ #y_bottom = [_y if _y >= 1 else 0.01 for _y in y]
112114 y_bottom = y
113115 elif count_type == "relative" :
114116 y = [self .counts_by_cluster_size_by_proteome_counts [proteome_count ][cluster_size ] for cluster_size in sorted (self .counts_by_cluster_size_by_proteome_counts [proteome_count ])]
@@ -131,10 +133,10 @@ def plot_cluster_sizes(self, plot_type):
131133 print "[+] Plotting \" %s\" ..." % (plot_type )
132134 if plot_type in PLOTS :
133135 if plot_type == "loglog" or plot_type == "loglin" or plot_type == "loglogpowerlaw" :
134- ax .set_yscale ('log' )
135136 for proteome_count , x , y , y_bottom , colour in self .yield_counts_by_proteome_count ('absolute' ):
136137 ax .plot (x , y , c = 'None' )
137- ax .fill_between (x , y , y_bottom , facecolor = colour )
138+ mask = np .where (y >= 1 , y , "nan" )
139+ ax .fill_between (x , y , y_bottom , facecolor = colour , interpolate = True , where = mask )
138140 progress (proteome_count , 1 , self .proteome_count_max )
139141 ax .plot
140142 elif plot_type == "logbar" :
@@ -185,9 +187,9 @@ def plot_cluster_sizes(self, plot_type):
185187 else :
186188 out_f = "%s.loglogpowerlaw.%s" % (self .out_prefix , self .plot_fmt )
187189 #ax.legend()
188- plt .gca ().set_ylim (bottom = 0.8 , top = self .cluster_count_max * 2 )
190+ plt .gca ().set_ylim (bottom = 0.9 , top = self .cluster_count_max * 2 )
189191 plt .gca ().set_xlim (left = 0.8 , right = self .cluster_size_max * 2 )
190- ax .set_yscale ('log' )
192+ ax .set_yscale ('symlog' , linthreshy = 1.0 )
191193 ax .set_xscale ('log' )
192194 legend_handles = []
193195 for colour , proteomes in self .proteome_counts_by_colour .items ():
@@ -197,7 +199,7 @@ def plot_cluster_sizes(self, plot_type):
197199 legend_handles .append (mpatches .Patch (label = "%s" % (proteomes [0 ]), color = colour ))
198200 legend = ax .legend (handles = legend_handles , ncol = 2 , loc = 'best' , numpoints = 1 , frameon = True , title = "Number of proteomes in cluster" )
199201 legend .get_frame ().set_facecolor ('white' )
200- plt .margins (0.8 )
202+ plt .margins (1 )
201203 ax .xaxis .set_major_formatter (FormatStrFormatter ('%.0f' ))
202204 ax .yaxis .set_major_formatter (FormatStrFormatter ('%.0f' ))
203205 ax .grid (True , linewidth = 0.5 , which = "minor" , color = "lightgrey" )
@@ -227,9 +229,9 @@ def plot_cluster_sizes(self, plot_type):
227229 print "[+] Start ..."
228230 dataObj = DataObj (out_prefix , plot_fmt , cmap , xlim )
229231 dataObj .parse_data (input_f )
230- dataObj .plot_cluster_sizes ('loglog' )
231- dataObj .plot_cluster_sizes ('loglin' )
232- dataObj .plot_cluster_sizes ('logbar' )
233- dataObj .plot_cluster_sizes ('barperc' )
234- dataObj .plot_cluster_sizes ('powerlaw' )
232+ # dataObj.plot_cluster_sizes('loglog')
233+ # dataObj.plot_cluster_sizes('loglin')
234+ # dataObj.plot_cluster_sizes('logbar')
235+ # dataObj.plot_cluster_sizes('barperc')
236+ # dataObj.plot_cluster_sizes('powerlaw')
235237 dataObj .plot_cluster_sizes ('loglogpowerlaw' )
0 commit comments