Index: /trunk/UTIL/PYTHON/planetoplot.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot.py	(revision 640)
+++ /trunk/UTIL/PYTHON/planetoplot.py	(revision 641)
@@ -581,14 +581,17 @@
                         if ope == '-' and nplot == numplot: # this should work as long as ope is '-' guarantees 3 plots for 4 panels without contour
                             subplot(subv,subh,nplot+1)
-                            latmin = -50.; latmax = 50. # latitude range for histogram of difference
-                            if indexlat is None: # a bit dirty, if field is not reduced along latitude, we assume lat is along the y axis
+                            if indexlat is None:
+                                latmin = -50.; latmax = 50. # latitude range for histogram of difference
                                 zeindexlat = (lat<latmax)*(lat>latmin)
-                                what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
+                                if (len(lat) == len(x)) and (len(lat) == len(y)): errormess('PLANETOPLOT.PY: I cant find which axis is lat for histogram.')
+                                elif len(lat) == len(x) : what_I_plot_frame = what_I_plot_frame[:,zeindexlat]
+                                elif len(lat) == len(y) : what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
+                                else: errormess('PLANETOPLOT.PY: indexlat is None, but I cant find the lat axis.')
                             toplot = np.ravel(what_I_plot_frame[np.isnan(what_I_plot_frame)==False])
-                            zebins = np.linspace(minop,maxop,num=30)
+                            zebins = np.linspace(zevmin,zevmax,num=30)
                             hist(toplot,bins=zebins,histtype='step',linewidth=2,color='k',normed=True)
                             zestd = np.std(toplot)
                             zemean = np.mean(toplot)
-                            zebins = np.linspace(minop,maxop,num=300)
+                            zebins = np.linspace(zevmin,zevmax,num=300)
                             zegauss = (1./(zestd * np.sqrt(2 * np.pi)) * np.exp( - (zebins - zemean)**2 / (2 * zestd**2) ) )
                             text(zebins[2],np.max(zegauss),'mean: '+str(zemean)[0:5]+'\nstd: '+str(zestd)[0:5],fontsize = 12)
