MCPcopy Create free account
hub / github.com/NatLabRockies/windtools / _format_legend

Function _format_legend

windtools/plotting.py:1842–1864  ·  view source on GitHub ↗

Auxiliary function to format legend Usage ===== axv : numpy 1d array Flattened array of axes index : int Index of the axis where to place the legend

(axv,index)

Source from the content-addressed store, hash-verified

1840
1841
1842def _format_legend(axv,index):
1843 """
1844 Auxiliary function to format legend
1845
1846 Usage
1847 =====
1848 axv : numpy 1d array
1849 Flattened array of axes
1850 index : int
1851 Index of the axis where to place the legend
1852 """
1853 all_handles = []
1854 all_labels = []
1855 # Check each axes and add new handle
1856 for axi in axv:
1857 handles, labels = axi.get_legend_handles_labels()
1858 for handle,label in zip(handles,labels):
1859 if not label in all_labels:
1860 all_labels.append(label)
1861 all_handles.append(handle)
1862
1863 leg = axv[index].legend(all_handles,all_labels,loc='upper left',bbox_to_anchor=(1.05,1.0),fontsize=16)
1864 return leg
1865
1866
1867def _format_time_axis(fig,ax,

Callers 3

plot_profileFunction · 0.85
plot_spectrumFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected