Changeset 642


Ignore:
Timestamp:
Apr 30, 2012, 6:15:33 PM (13 years ago)
Author:
tnavarro
Message:

Correction for histogram of difference. Write both variable and axis for 1D txt output - useful for gnuplot or sparse.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot.py

    r641 r642  
    536536                        if nplot > 1: legend(loc='best')
    537537                        if indextime is None and axtime is not None and xlab is None:    xlabel(axtime.upper()) ## define the right label
    538                         if save == 'txt':  writeascii(np.transpose(what_I_plot),'profile'+str(nplot*1000+imov)+'.txt')
     538                        if save == 'txt':  writeascii(np.transpose([x,np.transpose(what_I_plot)]),'profile'+str(nplot*1000+imov)+'.txt')
    539539
    540540                    elif which == "regular":
     
    581581                        if ope == '-' and nplot == numplot: # this should work as long as ope is '-' guarantees 3 plots for 4 panels without contour
    582582                            subplot(subv,subh,nplot+1)
     583                            rcParams["legend.fontsize"] = 'xx-large'
    583584                            if indexlat is None:
    584585                                latmin = -50.; latmax = 50. # latitude range for histogram of difference
    585586                                zeindexlat = (lat<latmax)*(lat>latmin)
    586                                 if (len(lat) == len(x)) and (len(lat) == len(y)): errormess('PLANETOPLOT.PY: I cant find which axis is lat for histogram.')
    587                                 elif len(lat) == len(x) : what_I_plot_frame = what_I_plot_frame[:,zeindexlat]
    588                                 elif len(lat) == len(y) : what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
    589                                 else: errormess('PLANETOPLOT.PY: indexlat is None, but I cant find the lat axis.')
     587                                # this follows the define_axis logic in myplot.py:
     588                                if indextime is None or indexlon is None: what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
     589                                else: what_I_plot_frame = what_I_plot_frame[:,zeindexlat]
    590590                            toplot = np.ravel(what_I_plot_frame[np.isnan(what_I_plot_frame)==False])
    591591                            zebins = np.linspace(zevmin,zevmax,num=30)
     
    595595                            zebins = np.linspace(zevmin,zevmax,num=300)
    596596                            zegauss = (1./(zestd * np.sqrt(2 * np.pi)) * np.exp( - (zebins - zemean)**2 / (2 * zestd**2) ) )
    597                             text(zebins[2],np.max(zegauss),'mean: '+str(zemean)[0:5]+'\nstd: '+str(zestd)[0:5],fontsize = 12)
    598                             plot(zebins, zegauss, linewidth=1, color='r')
     597                            plot(zebins, zegauss, linewidth=1, color='r',label="mean: "+str(zemean)[0:5]+"\nstd: "+str(zestd)[0:5])
     598                            legend(loc=0,frameon=False)
    599599                            title("Histogram fig(1) "+ope+" fig(2)")
    600600                            subplot(subv,subh,nplot) # go back to last plot for title of contour difference
    601 
     601                           
    602602                    elif which == "contour":
    603603                        zevminc, zevmaxc = calculate_bounds(what_I_plot_frame, vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame))
Note: See TracChangeset for help on using the changeset viewer.