[Dart-dev] [4479] DART/trunk/diagnostics/matlab/plot_obs_netcdf.m: 2D plots now honor the 'region' limits

nancy at ucar.edu nancy at ucar.edu
Mon Aug 16 16:45:41 MDT 2010


Revision: 4479
Author:   thoar
Date:     2010-08-16 16:45:41 -0600 (Mon, 16 Aug 2010)
Log Message:
-----------
2D plots now honor the 'region' limits

Modified Paths:
--------------
    DART/trunk/diagnostics/matlab/plot_obs_netcdf.m

-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/plot_obs_netcdf.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_obs_netcdf.m	2010-08-16 16:38:56 UTC (rev 4478)
+++ DART/trunk/diagnostics/matlab/plot_obs_netcdf.m	2010-08-16 22:45:41 UTC (rev 4479)
@@ -284,11 +284,13 @@
 orgholdstate = ishold;
 hold on;
 
-switch  get(gca,'ZDir')
-   case 'reverse'
-      zlevel = max(ax(5:6));
-   otherwise
-      zlevel = min(ax(5:6));
+if ( length(ax) > 4) 
+   switch  get(gca,'ZDir')
+      case 'reverse'
+         zlevel = max(ax(5:6));
+      otherwise
+         zlevel = min(ax(5:6));
+   end
 end
 
 fcolor = [0.7 0.7 0.7];    % light grey
@@ -378,9 +380,12 @@
 
 function h1 = plot_2D(obsstruct, pstruct)
 
-axis(pstruct.axis);
-
 if (pstruct.clim(1) == pstruct.clim(2))
+   % If all the observations have the same value, setting the
+   % colorbar limits is a real pain. Fundamentally, I am 
+   % forcing the plot symbols to be the lowest color of the
+   % colormap and setting the colorbar to have some more
+   % colors 'on top' - that are never used.
    cmap = colormap;
    h = plot(obsstruct.lons, obsstruct.lats, 'bd');
    set(h,'MarkerFaceColor',cmap(1,:),'MarkerEdgeColor',cmap(1,:))
@@ -396,6 +401,8 @@
 h1   = gca;
 clim = get(h1,'CLim');
 
+axis(pstruct.axis);
+
 title( {pstruct.str1, pstruct.str3, pstruct.str2}, 'Interpreter','none','FontSize',14);
 xlabel('longitude')
 ylabel('latitude')


More information about the Dart-dev mailing list