mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-04 04:38:02 +00:00 
			
		
		
		
	added legend location,legend column,legend fontsize,legend box
This commit is contained in:
		@@ -53,6 +53,11 @@ class lf_bar_graph():
 | 
				
			|||||||
                 _text_font=None,
 | 
					                 _text_font=None,
 | 
				
			||||||
                 _text_rotation=None,
 | 
					                 _text_rotation=None,
 | 
				
			||||||
                 _grp_title = "",
 | 
					                 _grp_title = "",
 | 
				
			||||||
 | 
					                 _legend_handles=None,
 | 
				
			||||||
 | 
					                 _legend_loc="best",
 | 
				
			||||||
 | 
					                 _legend_box=None,
 | 
				
			||||||
 | 
					                 _legend_ncol=1,
 | 
				
			||||||
 | 
					                 _legend_fontsize=None,
 | 
				
			||||||
                 _dpi=96,
 | 
					                 _dpi=96,
 | 
				
			||||||
                 _enable_csv=False):
 | 
					                 _enable_csv=False):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -79,6 +84,11 @@ class lf_bar_graph():
 | 
				
			|||||||
        self.grp_title = _grp_title
 | 
					        self.grp_title = _grp_title
 | 
				
			||||||
        self.enable_csv = _enable_csv
 | 
					        self.enable_csv = _enable_csv
 | 
				
			||||||
        self.lf_csv = lf_csv()
 | 
					        self.lf_csv = lf_csv()
 | 
				
			||||||
 | 
					        self.legend_handles = _legend_handles
 | 
				
			||||||
 | 
					        self.legend_loc = _legend_loc
 | 
				
			||||||
 | 
					        self.legend_box = _legend_box
 | 
				
			||||||
 | 
					        self.legend_ncol = _legend_ncol
 | 
				
			||||||
 | 
					        self.legend_fontsize = _legend_fontsize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def build_bar_graph(self):
 | 
					    def build_bar_graph(self):
 | 
				
			||||||
        if self.color is None:
 | 
					        if self.color is None:
 | 
				
			||||||
@@ -121,7 +131,7 @@ class lf_bar_graph():
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            plt.xticks(np.arange(0, len(self.data_set[0]), step=self.xaxis_step), self.xaxis_categories,
 | 
					            plt.xticks(np.arange(0, len(self.data_set[0]), step=self.xaxis_step), self.xaxis_categories,
 | 
				
			||||||
                       fontsize = self.xticks_font)
 | 
					                       fontsize = self.xticks_font)
 | 
				
			||||||
        plt.legend()
 | 
					        plt.legend(handles=self.legend_handles, loc=self.legend_loc, bbox_to_anchor=self.legend_box, ncol=self.legend_ncol, fontsize=self.legend_fontsize)
 | 
				
			||||||
        plt.suptitle(self.title, fontsize=self.title_size)
 | 
					        plt.suptitle(self.title, fontsize=self.title_size)
 | 
				
			||||||
        plt.title(self.grp_title)
 | 
					        plt.title(self.grp_title)
 | 
				
			||||||
        fig = plt.gcf()
 | 
					        fig = plt.gcf()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,7 +103,11 @@ if __name__ == "__main__":
 | 
				
			|||||||
                         _show_bar_value=True,
 | 
					                         _show_bar_value=True,
 | 
				
			||||||
                         _text_font=7,
 | 
					                         _text_font=7,
 | 
				
			||||||
                         _text_rotation=45,
 | 
					                         _text_rotation=45,
 | 
				
			||||||
                         _xticks_font=7)
 | 
					                         _xticks_font=7,
 | 
				
			||||||
 | 
					                         _legend_loc="best",
 | 
				
			||||||
 | 
					                         _legend_box=(1,1),
 | 
				
			||||||
 | 
					                         _legend_ncol=1,
 | 
				
			||||||
 | 
					                         _legend_fontsize=None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    graph_png = graph.build_bar_graph()
 | 
					    graph_png = graph.build_bar_graph()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user