def mass_flux_plot(*args,**kwargs): fltm = idls.read(args[0]) injm = idls.read(args[1]) f1 = plt.figure() ax1 = f1.add_subplot(211) plt.plot(injm.nt_sc,injm.nmf_rscale,'r') plt.plot(injm.nt_sc,injm.nmf_zscale,'b') plt.plot(injm.nt_sc,injm.nmf_z0scale,'k') plt.plot(injm.nt_sc,(injm.nmf_rscale+injm.nmf_zscale),'g') plt.axis([0.0,160.0,0.0,3.5e-5]) plt.minorticks_on() locs,labels = plt.yticks() plt.yticks(locs, map(lambda x: "%.1f" % x, locs*1e5)) plt.text(0.0, 1.03, r'$10^{-5}$', transform = plt.gca().transAxes) plt.xlabel(r'Time [yr]',labelpad=6) plt.ylabel(r'$\dot{\rm M}_{\rm out} [ \rm{M}_{\odot} \rm{yr}^{-1} ]$',labelpad=15) ax2 = f1.add_subplot(212) plt.plot(fltm.nt_sc,fltm.nmf_rscale,'r') plt.plot(fltm.nt_sc,fltm.nmf_zscale,'b') plt.plot(fltm.nt_sc,fltm.nmf_z0scale,'k') plt.plot(fltm.nt_sc,(fltm.nmf_rscale+fltm.nmf_zscale),'g') plt.axis([0.0,160.0,0.0,4.0e-5]) plt.minorticks_on() locs,labels = plt.yticks() plt.yticks(locs, map(lambda x: "%.1f" % x, locs*1e5)) plt.text(0.0, 1.03, r'$10^{-5}$', transform = plt.gca().transAxes) plt.xlabel(r'Time [yr]',labelpad=6) plt.ylabel(r'$\dot{\rm M}_{\rm out} [ \rm {M}_{\odot} \rm{yr}^{-1} ]$',labelpad=15)
def minj_mflux(*args,**kwargs): Qu = jana.quantities() Minj_List =[] Minj_MHD_List=[] for i in range(len(args[1])): Minj_List.append(Qu.Mflux(args[1][i],Mstar=args[0][i],scale=True)['Mfr']+Qu.Mflux(args[1][i],Mstar=args[0][i],scale=True)['Mfz']) MHD_30minj = Qu.Mflux(args[2],Mstar=30.0,scale=True)['Mfr']+Qu.Mflux(args[2],Mstar=30.0,scale=True)['Mfz'] for i in args[0]: Minj_MHD_List.append(MHD_30minj*np.sqrt(i/30.0)) f1 = plt.figure(num=1) ax1 = f1.add_subplot(211) plt.axis([10.0,70.0,2.0e-5,7.99e-5]) plt.plot(args[0],Minj_MHD_List,'k*') plt.plot(args[0],Minj_List,'ko') plt.minorticks_on() locs,labels = plt.yticks() plt.yticks(locs, map(lambda x: "%.1f" % x, locs*1e5)) plt.text(0.0, 1.03, r'$10^{-5}$', transform = plt.gca().transAxes) plt.xlabel(r'Stellar Mass : $M_{*} [M_{\odot}]$') plt.ylabel(r' $\dot{M}_{\rm vert} + \dot{M}_{\rm rad}\, [M_{\odot}\,\rm yr^{-1}]$') ax2 = f1.add_subplot(212) plt.axis([10.0,70.0,0.0,50.0]) plt.plot(args[0],100*((np.array(Minj_List)-np.array(Minj_MHD_List))/np.array(Minj_MHD_List)),'k^') plt.minorticks_on() plt.xlabel(r'Stellar Mass : $M_{*} [M_{\odot}]$') plt.ylabel(r'$\%$ Change in Total Mass Outflow Rates')
def do_plot_extras(self, extra): """ Plot other observed quantities as a function of time. Parameters ---------- extra: string One of the quantities available in system.extras """ # import pyqtgraph as pg colors = 'bgrcmykw' # lets hope for less than 9 data-sets t = self.time # handle inexistent field if extra not in self.extras._fields: from shell_colors import red msg = red('ERROR: ') + 'The name "%s" is not available in extras.\n' % extra clogger.fatal(msg) return i = self.extras._fields.index(extra) # index corresponding to this quantity plt.figure() # p = pg.plot() plt.plot(t, self.extras[i], 'o', label=extra) plt.xlabel('Time [days]') plt.ylabel(extra + ' []') plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05)) plt.minorticks_on() plt.tight_layout() plt.show()
def fourcumplot(x1,x2,x3,x4,xmin,xmax,x1leg='$x_1$',x2leg='$x_2$',x3leg='$x_3$',x4leg='$x_3$',xlabel='',ylabel='$N(x>x\')$',fig=1,sharey=False,fontsize=12,bins1=50,bins2=50,bins3=50,bins4=50): """ Script that plots the cumulative histograms of four variables x1, x2, x3 and x4 sharing the same X-axis. For each bin, Y is the fraction of the sample with values above X. Arguments: - x1,x2,x3,x4: arrays with data to be plotted - xmin,xmax: lower and upper range of plotted values, will be used to set a consistent x-range for both histograms. - x1leg, x2leg, x3leg, x4leg: legends for each histogram - xlabel: self-explanatory. - sharey: sharing the Y-axis among the histograms? - bins1,bins2,...: number of bins in each histogram - fig: which plot window should I use? Inspired by `Scipy <http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label>`_. v1 Jun. 2012: inherited from fourhists. """ pylab.rcParams.update({'font.size': fontsize}) fig=pylab.figure(fig) pylab.clf() a=fig.add_subplot(4,1,1) if sharey==True: b=fig.add_subplot(4,1,2, sharex=a, sharey=a) c=fig.add_subplot(4,1,3, sharex=a, sharey=a) d=fig.add_subplot(4,1,4, sharex=a, sharey=a) else: b=fig.add_subplot(4,1,2, sharex=a) c=fig.add_subplot(4,1,3, sharex=a) d=fig.add_subplot(4,1,4, sharex=a) a.hist(x1,bins1,label=x1leg,color='b',cumulative=-True,normed=True,histtype='stepfilled') a.legend(loc='best',frameon=False) a.set_xlim(xmin,xmax) b.hist(x2,bins2,label=x2leg,color='r',cumulative=-True,normed=True,histtype='stepfilled') b.legend(loc='best',frameon=False) c.hist(x3,bins3,label=x3leg,color='y',cumulative=-True,normed=True,histtype='stepfilled') c.legend(loc='best',frameon=False) d.hist(x4,bins4,label=x4leg,color='g',cumulative=-True,normed=True,histtype='stepfilled') d.legend(loc='best',frameon=False) pylab.setp(a.get_xticklabels(), visible=False) pylab.setp(b.get_xticklabels(), visible=False) pylab.setp(c.get_xticklabels(), visible=False) d.set_xlabel(xlabel) c.set_ylabel(ylabel) pylab.minorticks_on() pylab.subplots_adjust(hspace=0.15) pylab.draw() pylab.show()
def deg_coll_plots(dirlist=None, **kwargs): if kwargs.get("perzeta",False)==True: zetalist = [] for dirnames in dirlist: zetalist.append(zetaper(w_dir=dirnames,nrad=kwargs.get('nrad',638))) #f1 = plt.figure() plt.xlabel(r'Distance Along Field Line : s [AU]',labelpad=6) plt.ylabel(r'$\Delta \zeta [\%]$',labelpad=10) plt.plot(zetalist[0][0],zetalist[0][1],'k-.') plt.plot(zetalist[1][0],zetalist[1][1],'k--') plt.plot(zetalist[2][0],zetalist[2][1],'k') plt.axis([0.0,150.0,0.0,40.0]) plt.minorticks_on() else: magalf = np.linspace(19.67,19.67,100) magfast = np.linspace(12.53,12.53,100) Msarr = [20.0,25.0,30.0,45.0,50.0,60.0] alfMs = [20.44,23.27,26.05, 26.84, 28.86,31.45] fastMs = [15.57,19.94,23.40,24.35,26.03,29.25] asymMs=[] Alparr = [0.55,0.60,0.65] alfAlp =[31.35,23.73,20.93] fastAlp=[29.25,21.48,17.28] asymAlp =[] Denarr =[3.0e-14,5.0e-14,1.0e-13,5.0e-13] alfDen =[30.30,26.05,22.91,20.42] fastDen =[27.79,23.40,19.47,15.03] asymDen=[] Betarr=[1.0,3.0,5.0] alfBet =[21.98,25.63,26.05] fastBet=[16.45,20.68,23.40] asymBet=[] #nice_plots() #f1 = plt.figure() #ax1 = f1.add_subplot(111) plt.ylabel(r"Opening Angle : $\phi^\circ$",labelpad=10) plt.minorticks_on() if kwargs.get('cplot',False)==True: dum1 = np.linspace(1.0e-14,1.0e-12,100) ms1 = plt.semilogx(Denarr,alfDen,'r*') ms2 = plt.semilogx(Denarr,fastDen,'bo') plt.xlabel(r"Base Density : $\rho_0$ [g/cm$^{3}$]") plt.semilogx(dum1,magalf,'r--',dum1,magfast,'b--') plt.axis([1.0e-14,1.0e-12,10.0,35.0]) # plt.legend([ms1,ms2],[r'Alfven point',r'Fast point'],loc='lower left') else: dum1 = np.linspace(10.0,70.0,100) ms1 = plt.plot(Msarr,alfMs,'k*') ms2 = plt.plot(Msarr,fastMs,'ko') plt.xlabel(r"Stellar Mass : $M_{*}$ [$M_{\odot}$]",labelpad=6) plt.plot(dum1,magalf,'k--',dum1,magfast,'k') plt.axis([10.0,70.0,10.0,35.0])
def threehists(x1,x2,x3,xmin,xmax,x1leg='$x_1$',x2leg='$x_2$',x3leg='$x_3$',xlabel='',fig=1,sharey=False,fontsize=12): """ Script that plots three histograms of quantities x1, x2 and x3 sharing the same X-axis. Arguments: - x1,x2,x3: arrays with data to be plotted - xmin,xmax: lower and upper range of plotted values, will be used to set a consistent x-range for both histograms. - x1leg, x2leg, x3leg: legends for each histogram - xlabel: self-explanatory. - sharey: sharing the Y-axis among the histograms? - fig: which plot window should I use? Example: x1=Lbol(AD), x2=Lbol(JD), x3=Lbol(EHF10) >>> threehists(x1,x2,x3,38,44,'AD','JD','EHF10','$\log L_{\\rm bol}$ (erg s$^{-1}$)',sharey=True) Inspired by `Scipy <http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label>`_. """ pylab.rcParams.update({'font.size': fontsize}) fig=pylab.figure(fig) pylab.clf() a=fig.add_subplot(3,1,1) if sharey==True: b=fig.add_subplot(3,1,2, sharex=a, sharey=a) c=fig.add_subplot(3,1,3, sharex=a, sharey=a) else: b=fig.add_subplot(3,1,2, sharex=a) c=fig.add_subplot(3,1,3, sharex=a) a.hist(x1,label=x1leg,color='b',histtype='stepfilled') a.legend(loc='best',frameon=False) a.set_xlim(xmin,xmax) b.hist(x2,label=x2leg,color='r',histtype='stepfilled') b.legend(loc='best',frameon=False) c.hist(x3,label=x3leg,color='y',histtype='stepfilled') c.legend(loc='best',frameon=False) pylab.setp(a.get_xticklabels(), visible=False) pylab.setp(b.get_xticklabels(), visible=False) c.set_xlabel(xlabel) b.set_ylabel('Number') pylab.minorticks_on() pylab.subplots_adjust(hspace=0.15) pylab.draw() pylab.show()
def twohists(x1,x2,xmin,xmax,range=None,x1leg='$x_1$',x2leg='$x_2$',xlabel='',fig=1,sharey=False,fontsize=12,bins1=10,bins2=10): """ Script that plots two histograms of quantities x1 and x2 sharing the same X-axis. :param x1,x2: arrays with data to be plotted :param xmin,xmax: lower and upper range of plotted values, will be used to set a consistent x-range for both histograms. :param x1leg, x2leg: legends for each histogram :param xlabel: self-explanatory. :param bins1,bins2: number of bins in each histogram :param fig: which plot window should I use? :param range: in the form (xmin,xmax), same as range argument for hist and applied to both histograms. Inspired by `Scipy <http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label>`_. """ pylab.rcParams.update({'font.size': fontsize}) fig=pylab.figure(fig) pylab.clf() a=fig.add_subplot(2,1,1) if sharey==True: b=fig.add_subplot(2,1,2, sharex=a, sharey=a) else: b=fig.add_subplot(2,1,2, sharex=a) a.hist(x1,bins1,label=x1leg,color='b',histtype='stepfilled',range=range) a.legend(loc='best',frameon=False) a.set_xlim(xmin,xmax) b.hist(x2,bins2,label=x2leg,color='r',histtype='stepfilled',range=range) b.legend(loc='best',frameon=False) pylab.setp(a.get_xticklabels(), visible=False) b.set_xlabel(xlabel) b.set_ylabel('Number',verticalalignment='bottom') pylab.minorticks_on() pylab.subplots_adjust(hspace=0.15) pylab.draw() pylab.show()
def plotter(filename, ptype): data = np.loadtxt(dir+filename) # frequencies omegaR = data[:,3] omegaz = data[:,5] # angles thetaR = data[:,6] thetaz = data[:,8] thetaR_t = (np.pi+(thetaR-np.median(data[:,6]))) % (2.*np.pi) thetaz_t = (np.pi+(thetaz-np.median(data[:,8]))) % (2.*np.pi) colors = cm.rainbow(np.linspace(0, 1, len(omegaR))) if ptype == "freqs": plt.scatter(omegaR*fact,omegaz*fact, color=colors) # progenitor location plt.plot(value[3]*fact,value[5]*fact,"ko", ms=12) plt.xlabel(r"$\Omega_R \mathrm{(Gyr^{-1})}$",fontsize=20) plt.ylabel(r"$\Omega_z \mathrm{(Gyr^{-1})}$",fontsize=20) plt.grid(which='minor') plt.minorticks_on() elif ptype == "angles": # moved stream particles plt.scatter(thetaR_t,thetaz_t, color=colors) # progenitor location plt.plot(val6,val8,"ko", ms=12) plt.grid(which='minor') plt.minorticks_on() plt.xlabel(r"$\theta_R}$",fontsize=20) plt.ylabel(r"$\theta_z}$",fontsize=20)
def log_datafit(x, y, deg): z = np.polyfit(np.log10(x), np.log10(y), deg) p = np.poly1d(z) A = np.zeros(np.shape(p)[0]) for i in range(np.shape(p)[0]): A[::-1][i] = p[i] yvals = 0. for j in range(np.shape(p)[0]): yvals += (((np.log10(x))**j)*A[::-1][j]) plt.ion() plt.loglog(x, y, 'bo', label='Data') plt.loglog(x, 10**(yvals), 'g--', lw=2, label='Best Fit') plt.legend(loc='best') plt.grid(which='minor') plt.minorticks_on() print "Ax+B" print "A = ", A[0] print "B =", A[1]
def plot_spectrum(self, ax, data, stat=None, label_axes=True): """ Compute and plot spectral statistic. If stat is set to None, will use currentIndex of stat_select combo box """ if len(data.shape) == 1: data = np.reshape(data, (1, len(data))) x_pow = np.abs(data) if stat == None: if self.scale_select.currentIndex() == 0: ax.plot(x_pow, label='linear') elif self.scale_select.currentIndex() == 1: ax.plot(10*np.log10(x_pow), label='decibels') elif self.scale_select.currentIndex() == 2: ax.plot(np.var(x_pow, axis=0), label='variance') elif self.scale_select.currentIndex() == 3: ax.plot(skew(x_pow, axis=0), label='skew') elif self.scale_select.currentIndex() == 4: ax.plot(kurtosis(x_pow, axis=0), label='kurtosis') else: if self.scale_select.currentIndex() == 1: x_pow = 10*np.log10(x_pow) if stat == 'median' or stat == 'med': ax.plot(np.median(x_pow, axis=0), label='median') if stat == 'min': ax.plot(np.min(x_pow, axis=0), label='min') if stat == 'max': ax.plot(np.max(x_pow, axis=0), label='max') plt.minorticks_on() if label_axes: self.updateFreqAxis(ax, n_ticks=10) plt.xlabel("Frequency") plt.ylabel("Amplitude") plt.legend()
def threehistsx(x1,x2,x3,x1leg='$x_1$',x2leg='$x_2$',x3leg='$x_3$',fig=1,fontsize=12,bins1=10,bins2=10,bins3=10): """ Script that pretty-plots three histograms of quantities x1, x2 and x3. Arguments: :param x1,x2,x3: arrays with data to be plotted :param x1leg, x2leg, x3leg: legends for each histogram :param fig: which plot window should I use? Example: x1=Lbol(AD), x2=Lbol(JD), x3=Lbol(EHF10) >>> threehists(x1,x2,x3,38,44,'AD','JD','EHF10','$\log L_{\\rm bol}$ (erg s$^{-1}$)') Inspired by http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label. """ pylab.rcParams.update({'font.size': fontsize}) pylab.figure(fig) pylab.clf() pylab.subplot(3,1,1) pylab.hist(x1,label=x1leg,color='b',bins=bins1) pylab.legend(loc='best',frameon=False) pylab.subplot(3,1,2) pylab.hist(x2,label=x2leg,color='r',bins=bins2) pylab.legend(loc='best',frameon=False) pylab.subplot(3,1,3) pylab.hist(x3,label=x3leg,color='y',bins=bins3) pylab.legend(loc='best',frameon=False) pylab.minorticks_on() pylab.subplots_adjust(hspace=0.15) pylab.draw() pylab.show()
N_KOS = np.linspace(0, 60, 121) N_motor_arr = [] for i in I_ARR: N_motor_arr.append(N_KOS * i) N_motor = N_KOS * I_TOTAL N_m_1 = N_KOS * I_ARR[1] import matplotlib import matplotlib.pylab as plt #from matplotlib import rc fig = matplotlib.pyplot.gcf() fig.set_size_inches(18.5, 10.5, forward=True) plt.rc('text', usetex=True) plt.rc('font', family='serif') for item, num in enumerate(N_motor_arr): #print (num) plt.plot(N_KOS, N_motor_arr[item], label='$i = %i*3.2$' % I_RED[item]) # for i in range(len(N_motor_arr)): # plt.plot(N_KOS, N_motor_arr[i], label='$i = %i*3.2$' % I_RED[i]) plt.ylim(ymax=7000, ymin=0) plt.minorticks_on() plt.grid(b=True, which='major', color='k', linestyle='-') plt.grid(b=True, which='minor', color='r', linestyle='--') plt.title(r'\textbf{Brzina vrtnje kosarice za Intecno reduktore}') plt.ylabel(r'\textbf{Brzina vrtnje motora} [o/min]') plt.xlabel(r'\textbf{Brzina vrtnje kosarice} [o/min]') plt.legend() plt.show()
def fourhists(x1,x2,x3,x4,xmin,xmax,x1leg='$x_1$',x2leg='$x_2$',x3leg='$x_3$',x4leg='$x_3$',xlabel='',fig=1,sharey=False,fontsize=12,bins1=10,bins2=10,bins3=10,bins4=10,line1=None,line2=None,line3=None,line4=None,line1b=None,line2b=None,line3b=None,line4b=None,loc='best'): """ Script that plots four histograms of quantities x1, x2, x3 and x4 sharing the same X-axis. Arguments: - x1,x2,x3,x4: arrays with data to be plotted - xmin,xmax: lower and upper range of plotted values, will be used to set a consistent x-range or both histograms. - x1leg, x2leg, x3leg, x4leg: legends for each histogram - xlabel: self-explanatory. - sharey: sharing the Y-axis among the histograms? - bins1,bins2,...: number of bins in each histogram - fig: which plot window should I use? - line?: draws vertical solid lines at the positions indicated in each panel - line?b: draws vertical dashed lines at the positions indicated in each panel .. figure:: ../figures/fourhists.png :scale: 100 % :alt: Four histograms in the same figure Four histograms in the same figure. Inspired by `Scipy <http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label>`_. """ pylab.rcParams.update({'font.size': fontsize}) fig=pylab.figure(fig) pylab.clf() a=fig.add_subplot(4,1,1) if sharey==True: b=fig.add_subplot(4,1,2, sharex=a, sharey=a) c=fig.add_subplot(4,1,3, sharex=a, sharey=a) d=fig.add_subplot(4,1,4, sharex=a, sharey=a) else: b=fig.add_subplot(4,1,2, sharex=a) c=fig.add_subplot(4,1,3, sharex=a) d=fig.add_subplot(4,1,4, sharex=a) def vline(hist,value,linestyle='k'): """Draw vertical line""" yax=hist.set_ylim() hist.plot([value,value],[yax[0],yax[1]],linestyle,linewidth=2) a.hist(x1,bins1,label=x1leg,color='b',histtype='stepfilled') a.legend(loc=loc,frameon=False) a.set_xlim(xmin,xmax) if line1!=None: vline(a,line1) if line1b!=None: vline(a,line1b,'k--') b.hist(x2,bins2,label=x2leg,color='r',histtype='stepfilled') b.legend(loc=loc,frameon=False) if line2!=None: vline(b,line2) if line2b!=None: vline(b,line2b,'k--') c.hist(x3,bins3,label=x3leg,color='y',histtype='stepfilled') c.legend(loc=loc,frameon=False) if line3!=None: vline(c,line3) if line3b!=None: vline(c,line3b,'k--') d.hist(x4,bins4,label=x4leg,color='g',histtype='stepfilled') d.legend(loc=loc,frameon=False) if line4!=None: vline(d,line4) if line4b!=None: vline(d,line4b,'k--') pylab.setp(a.get_xticklabels(), visible=False) pylab.setp(b.get_xticklabels(), visible=False) pylab.setp(c.get_xticklabels(), visible=False) d.set_xlabel(xlabel) c.set_ylabel('Number') pylab.minorticks_on() pylab.subplots_adjust(hspace=0.15) pylab.draw() pylab.show()
#plt.subplot(3,1,3) y, binEdges = np.histogram(l3, bins=nbins, density=False) bincenters = 0.5 * (binEdges[1:] + binEdges[:-1]) plt.plot(bincenters, y, '-', lw=1.5, label=r"$\lambda_3$") #strLabel = r"$\lambda_3$" #errorfill(bincenters, y, np.sqrt(y), color='r', alpha_fill=0.3) plt.yscale('log') #plt.xscale('symlog') plt.ylabel("PDF") plt.xlabel(r"$\lambda$") plt.legend(loc="upper left") plt.xlim(-xlimits, xlimits) plt.minorticks_on() #plt.ylim(1e-5,) #plt.show() plt.savefig("plots/Evalcompare.pdf", bbox_inches="tight") # # ------------------- Non-Void distribution ------------------------------------ #file_nstr = './npy/Half/numFieldHalf_032_'+ str(refFactor)+'.npy' file_nstr = './npy/numField_051_' + str(refFactor) + '.npy' nstream = np.load(file_nstr).astype(np.float64) #l3 = np.sum(l, axis = 3) l1 = l[:, :, :, 0]
k0 = 0 #Gráficos: for a in a_s: #-X- plb.subplot(121) exponente = -((np.sqrt(2) * x / a)**2) A = 2 / (a * (np.sqrt(2 * np.pi))) PSI_modcdr = A * np.exp(exponente) plb.xlabel("$x$", fontweight='bold', size=20) plb.ylabel("$|\psi(x,0)|^{2}$", fontweight='bold', size=20) plb.plot(x, PSI_modcdr, lw=3) #Para la cuadrícula plb.grid(b=True, which='major', color='k', linestyle='-') plb.minorticks_on() plb.grid(b=True, which='minor', color='k', linestyle=':', alpha=1) #Para la leyenda plb.legend([r"$a=%.2f$" % (i) for i in a_s], loc="upper right") #-K- plb.subplot(122) exponente = ((-(a**2) / 2)) * ((k - k0)**2) A = a / (np.sqrt(2 * np.pi)) PHI_modcdr = A * (np.exp(exponente)) plb.xlabel("$k$", fontweight='bold', size=20) plb.ylabel("$|\phi(k)|^{2}$", fontweight='bold', size=20) plb.plot(k, PHI_modcdr, lw=3) #Para la cuadrícula plb.grid(b=True, which='major', color='k', linestyle='-') plb.minorticks_on()