Skip to content
Snippets Groups Projects
Panel_Plot.py 51.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
                #  Print time validity
                if Ltime:
                    self.showTimeText(self.ax, iax, str(Ltime[i]))
    
                #  Bins by labels
                labels = np.array([str(L) for L in Lbins[i]])
    
                #  Plot
                cf = self.ax[iax].bar(labels, var * Lfacconv[i], width=Lwidth[i], color=Lcolor[i], linewidth=Llinewidth[i], edgecolor=Llinecolor[i])
    
                #  Legend
                # TODO : Handling legend with overlap two axis lines in the same box. For now, placement is by hand
                if not id_overlap:
                    self.ax[iax].legend(loc=LlocLegend[i], bbox_to_anchor=(1, 0.95))
                else:
                    self.ax[iax].legend(loc=LlocLegend[i], bbox_to_anchor=(1, 0.90))
    
                #  Title
                if Ltitle:
                    self.set_Title(self.ax, iax, Ltitle[i], id_overlap, Lxlab[i], Lylab[i])
    
                #  X/Y Axis label
                if id_overlap:
                    self.ax[iax].xaxis.tick_top()
                    self.ax[iax].xaxis.set_label_position('top')
                    self.ax[iax].set_xlabel(Lxlab[i])
                    self.ax[iax].set_ylabel(Lylab[i])
                else:
                    self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i])
    
                self.ax[iax].tick_params(axis='x', colors=LaxisColor[i])
    
                # X/Y Axis limits value
                if Lxlim:
                    try:
                        self.set_xlim(self.ax, iax, Lxlim[i])
                    except BaseException:
                        pass
                if Lylim:
                    try:
                        self.set_ylim(self.ax, iax, Lylim[i])
                    except BaseException:
                        pass
    
            return self.fig
    # def initialize_default_val(Lvar, Dparam):
    
    #    #TODO : initialize default value for all parameter of all type of graphs
    #    #Returns All the parameters given in Dparam where :
    #    "- If no value is found (empty list []) : return the default value (if exist) * number of graph
    #    #- If ONE value only is found : return the value copied x times the number of graph
    #    #- If the list is complete, nothing is done
    #    #CURRENT PROBLEM
    
    #    #The returned value do not change the true referenced variable given as argument
    
    #    #  Number of graphs
    #    l = len(Lvar)
    
    #    #  Add an extra percentage of the top max value for forcing the colorbar show the true user maximum value (correct a bug)
    #    #if Dparam['Lstep'] and Dparam['Lmaxval']: Dparam['Lmaxval'] = list(map(lambda x, y: x + 1E-6*y, Dparam['Lmaxval'], Dparam['Lstep']) ) #The extra value is 1E-6 times the step ticks of the colorbar
    #    print(Dparam.items())
    
    #    #  Read on which parameters initialize the default values
    #    for args_t in list(Dparam.items()):  #  Test on all arguments present, if they are empty list, default values apply for each graph
    #      args = list(args_t)
    #      print(args)
    #      if args[0] == 'Lfacconv' and not args[1]: args[1] = [1.0]*l
    #      elif args[0] == 'Lcolormap' and not args[1]: args[1] = ['gist_rainbow_r']*l
    #      elif args[0] == 'LcolorLine' and not args[1]: args[1] = ['black']*l
    #      elif args[0] == 'Lpltype' and not args[1]: args[1]= ['cf']*l
    #      elif args[0] == 'LaddWhite_cm' and not args[1]: args[1] = ['False']*l
    #      elif args[0] == 'Lstep' and not args[1]: args[1] = [None]*l #  default value filled later
    #      elif args[0] == 'Lstepticks' and not args[1]: args[1] = [None]*l
    #      Dparam[args[0]] = args[1]
    #      print(args)
    
    #    #  Check if there is no value for a parameter
    
    # for args_t in list(Dparam.items()):
    
    # for i in range(l):
    # if 'Lstepticks' in arguments.args and 'Lmaxval' in arguments.args and 'Lminval' in arguments.args:
    # Lstep[i] = (Lmaxval[i] - Lminval[i])/20  #  Default value of number of steps is 20
    # Lstepticks[i] = Lstep[i]  #  Default value is stepticks are the same as steps values
    #