diff --git a/pub/lib/plot.cpp b/pub/lib/plot.cpp
index 4068199f38878346392170c142212b7966eae6e0..bd91b785a1d7b61c0426fe3e6ab22642fb5282ac 100644
--- a/pub/lib/plot.cpp
+++ b/pub/lib/plot.cpp
@@ -568,14 +568,19 @@ namespace {
         for (size_t j=0; j<m; ++j) {
             const CSpec* s = fd->VS(j);
             vector<double> xlim = triv::histogram_limits(s->x);
-            for (size_t i=0; i<s->size(); ++i)
+            bool block_empty = false;
+            for (size_t i=0; i<s->size(); ++i) {
                 if (  (plot->Y.force || plot->Y.contains(s->y[i]))
                     && plot->X.contains(xlim[i]) && plot->X.contains(xlim[i+1])
-                    && plot->Z.contains(zlim[j]) && plot->Z.contains(zlim[j+1]))
+                    && plot->Z.contains(zlim[j]) && plot->Z.contains(zlim[j+1])) {
+                    block_empty = false;
                     plot->ps_line(
                         str(format("%13.7g wx %13.7g wx  %13.7g wy %13.7g wy  %13.7g wH t2d")
                             % xlim[i] % xlim[i+1] % zlim[j] % zlim[j+1] % s->y[i] ) );
-            plot->ps_line("");
+                }
+            }
+            if (!block_empty)
+                plot->ps_line("");
         }
         plot->close_frame2D(fd->xco.str_ps(), fd->ZCo[0].str_ps(), fd->yco.str_ps());
         // doclines
diff --git a/pub/plot/ps_plotter.cpp b/pub/plot/ps_plotter.cpp
index 6f15c97d40ec45b8d37ed24e08c7274bca82d21e..caf204fa120e8cef35256f161fccbe4c916da932 100644
--- a/pub/plot/ps_plotter.cpp
+++ b/pub/plot/ps_plotter.cpp
@@ -70,13 +70,14 @@ void CPS_Plotter::start_frame2D(
     ps_accu += ps_coord(X);
     ps_accu += ps_coord(Z);
     ps_accu += ps_coord(Y);
-    ps_accu += "\n";
+    ps_accu += "\n%% 2D image begin\n";
 }
 
 void CPS_Plotter::close_frame2D(
     const CAxis& _X, const CAxis& _Z, const CAxis& _Y,
     const std::string& xlabel, const std::string& zlabel, const std::string& ylabel)
 {
+    ps_accu += "%% 2D image end\n\n";
     ps_accu += "/linsetTic {white 1 setline} def\n";
     ps_accu += "/linsetTac {white 1.3 setline} def\n\n";