util/plotfig.py
def _simpleline_plotting(self, x, y, yerr = None, xlabel='', ylabel='', legend = None, xlim = None, ylim = None, scaling = False):
            """
            Plot an array using simple lines
            For better showing, rescaling each array into range of 0 to 1
            --------------------------------------
            Parameters:
                x: range of x-axis
                y: data array, a x*y array, y means number of lines
                xlabel: xlabel
                ylabel: ylabel
                legend: legend
                xlim: By default is None, if ylim exists, limit x values of figure, [xmin, xmax]
                ylim: By default is None, if ylim exists, limit y values of figure, [ymin, ymax]
                scaling: whether do rescaling or not to show multiple lines
            Example:
                >>> plotline(x, y, yerr)
            """
            if y.ndim == 1:
                y = np.expand_dims(y, axis = -1)
            if yerr is not None:
                if yerr.ndim == 1:
                    yerr = np.expand_dims(yerr, axis = -1)
            fig, ax = plt.subplots()
            COLORNUM = y.shape[-1]
            cm = plt.get_cmap('Dark2')
            ax.set_color_cycle([cm(1.0*i/COLORNUM) for i in range(COLORNUM)])
            if scaling is True:
                y_scaling = np.zeros_like(y)
                for i in range(y.shape[1]):
                    y_scaling[:,i] = (y[:,i]-np.min(y[:,i]))/(np.max(y[:,i])-np.min(y[:,i]))
            else:
                y_scaling = y
            for i in range(y_scaling.shape[-1]):
                if yerr is not None:
                    plt.errorbar(x, y_scaling[:,i], yerr = yerr[:,i])
                else:
                    plt.errorbar(x, y_scaling[:,i], yerr = yerr)
            if legend is not None:
                plt.legend(legend, fontsize = 14)
            plt.xlabel(xlabel)
            plt.ylabel(ylabel)
            if xlim is not None:
                plt.xlim(xlim)
            if ylim is not None:
                plt.ylim(ylim)
            if self._isshow is True:
                plt.show()

            Plot an array using simple lines
            For better showing, rescaling each array into range of 0 to 1
            --------------------------------------
            Parameters:
                x: range of x-axis
                y: data array, a x*y array, y means number of lines
                xlabel: xlabel
                ylabel: ylabel
                legend: legend
                xlim: By default is None, if ylim exists, limit x values of figure, [xmin, xmax]
                ylim: By default is None, if ylim exists, limit y values of figure, [ymin, ymax]
                scaling: whether do rescaling or not to show multiple lines
            Example:
                >>> plotline(x, y, yerr)
            
Plot an array using simple lines
For better showing, rescaling each array into range of 0 to 1
Plot an array using simple lines For better showing rescaling each array into range of 0 to 1
def _simpleline_plotting(self, x, y, yerr = None, xlabel='', ylabel='', legend = None, xlim = None, ylim = None, scaling = False):
            if y.ndim == 1:
                y = np.expand_dims(y, axis = -1)
            if yerr is not None:
                if yerr.ndim == 1:
                    yerr = np.expand_dims(yerr, axis = -1)
            fig, ax = plt.subplots()
            COLORNUM = y.shape[-1]
            cm = plt.get_cmap('Dark2')
            ax.set_color_cycle([cm(1.0*i/COLORNUM) for i in range(COLORNUM)])
            if scaling is True:
                y_scaling = np.zeros_like(y)
                for i in range(y.shape[1]):
                    y_scaling[:,i] = (y[:,i]-np.min(y[:,i]))/(np.max(y[:,i])-np.min(y[:,i]))
            else:
                y_scaling = y
            for i in range(y_scaling.shape[-1]):
                if yerr is not None:
                    plt.errorbar(x, y_scaling[:,i], yerr = yerr[:,i])
                else:
                    plt.errorbar(x, y_scaling[:,i], yerr = yerr)
            if legend is not None:
                plt.legend(legend, fontsize = 14)
            plt.xlabel(xlabel)
            plt.ylabel(ylabel)
            if xlim is not None:
                plt.xlim(xlim)
            if ylim is not None:
                plt.ylim(ylim)
            if self._isshow is True:
                plt.show()
def _simpleline_plotting ( self , x , y , yerr = None , xlabel = '' , ylabel = '' , legend = None , xlim = None , ylim = None , scaling = False ) : if y . ndim == 1 : y = np . expand_dims ( y , axis = - 1 ) if yerr is not None : if yerr . ndim == 1 : yerr = np . expand_dims ( yerr , axis = - 1 ) fig , ax = plt . subplots ( ) COLORNUM = y . shape [ - 1 ] cm = plt . get_cmap ( 'Dark2' ) ax . set_color_cycle ( [ cm ( 1.0 * i / COLORNUM ) for i in range ( COLORNUM ) ] ) if scaling is True : y_scaling = np . zeros_like ( y ) for i in range ( y . shape [ 1 ] ) : y_scaling [ : , i ] = ( y [ : , i ] - np . min ( y [ : , i ] ) ) / ( np . max ( y [ : , i ] ) - np . min ( y [ : , i ] ) ) else : y_scaling = y for i in range ( y_scaling . shape [ - 1 ] ) : if yerr is not None : plt . errorbar ( x , y_scaling [ : , i ] , yerr = yerr [ : , i ] ) else : plt . errorbar ( x , y_scaling [ : , i ] , yerr = yerr ) if legend is not None : plt . legend ( legend , fontsize = 14 ) plt . xlabel ( xlabel ) plt . ylabel ( ylabel ) if xlim is not None : plt . xlim ( xlim ) if ylim is not None : plt . ylim ( ylim ) if self . _isshow is True : plt . show ( )
Plot an array using simple lines
For better showing, rescaling each array into range of 0 to 1
Plot an array using simple lines For better showing rescaling each array into range of 0 to 1
"""
            Plot an array using simple lines
            For better showing, rescaling each array into range of 0 to 1
            --------------------------------------
            Parameters:
                x: range of x-axis
                y: data array, a x*y array, y means number of lines
                xlabel: xlabel
                ylabel: ylabel
                legend: legend
                xlim: By default is None, if ylim exists, limit x values of figure, [xmin, xmax]
                ylim: By default is None, if ylim exists, limit y values of figure, [ymin, ymax]
                scaling: whether do rescaling or not to show multiple lines
            Example:
                >>> plotline(x, y, yerr)
            """
self
x
range of x-axis
range of x - axis
y
data array, a x*y array, y means number of lines
data array a x * y array y means number of lines
yerr
xlabel
None
ylabel
None
legend
None
xlim
By default is None, if ylim exists, limit x values of figure, [xmin, xmax]
By default is None if ylim exists limit x values of figure [ xmin xmax ]
ylim
By default is None, if ylim exists, limit y values of figure, [ymin, ymax]
By default is None if ylim exists limit y values of figure [ ymin ymax ]
scaling
whether do rescaling or not to show multiple lines
whether do rescaling or not to show multiple lines
examples
>>> plotline(x, y, yerr)
>>> plotline ( x y yerr )