diff --git a/src/dualplot.cpp b/src/dualplot.cpp
index c8dca908b7217171c599e1eaef742a3efb353a00..52ed5927ffd8a3012fd571a68a5cfbcbcccf8050 100644
--- a/src/dualplot.cpp
+++ b/src/dualplot.cpp
@@ -278,8 +278,7 @@ void NPlot::Open()
     }
     fcntl(gp_fifo,F_SETFL,O_NONBLOCK);
 
-    // gp_write(string("plot 1 2 3")); // test
-    gp_write(string("set terminal x11"));
+    gp_write( string("set terminal x11") );
 
     ps_fnum=0;
 }
@@ -369,7 +368,7 @@ void NPlot::Box()
     ps_accu.push_back( "\n%% modeDD\nplotbefore\n" );
 }
 
-void NPlot::Line( const int lstyle, 
+void NPlot::Line( const bool as_line, const int style_no,
 		  const vector<double> xp, const vector<double> yp,
 		  const vector<double>* z,
 		  const string xco, const string yco,
@@ -382,7 +381,7 @@ void NPlot::Line( const int lstyle,
     if ( np!=yp.size() )
         throw string( "PROG ERR NPLot::Line x.size<>y.size" );
 
-    // Save to file:
+    // Data to tmp file:
     char gp_fnam[40];
     sprintf( gp_fnam, "/tmp/%s-%03d.gnu", getenv("LOGNAME"), gp_fno++);
     if (gp_fnames!="") gp_fnames += ", ";
@@ -390,7 +389,7 @@ void NPlot::Line( const int lstyle,
         //		string(" title \"") + xco + string (" -> ") 
         //		                    + yco + string ("\"");
         " notitle";
-    if (lstyle<0)
+    if ( as_line )
         gp_fnames += " with lines";
     FILE *gp_fd;
     if (!(gp_fd = fopen(gp_fnam, "w")))
@@ -399,27 +398,29 @@ void NPlot::Line( const int lstyle,
         fprintf(gp_fd, "%16.8g %16.8g\n", xp[i], yp[i]);
     fclose(gp_fd);
 	
-    // Plot command:
+    // Live display:
+    string cmd = "plot ";
     char aux[80];
     sprintf( aux, "[%12.8g:%12.8g] [%12.8g:%12.8g] ", 
              X.R.inf, X.R.sup, Y.R.inf, Y.R.sup);
-    gp_write(string("plot ") + aux + gp_fnames);
+    cmd += aux + gp_fnames;
+    gp_write( cmd );
 
-    snprintf( outlin, LINSIZ, "\n%3u [", ++ps_snum);
+    // Postscript copy:
+    snprintf( outlin, LINSIZ, "\n%3u [", ++ps_snum );
     ps_accu.push_back( outlin );
     for (uint i=0; i<z->size(); i++){
         snprintf( outlin, LINSIZ, " %12g", (*z)[i]);
         ps_accu.push_back( outlin );
     }
-    snprintf( outlin, LINSIZ, " ] zValues\n");
+    snprintf( outlin, LINSIZ, " ] zValues\n" );
     ps_accu.push_back( outlin );
-
-    if (lstyle>=0)
-        snprintf( outlin, LINSIZ, "%2d pstyle", ++ps_pnum);
+    if ( as_line )
+        snprintf( outlin, LINSIZ, "%2d cstyle", 1 );
     else
-        snprintf( outlin, LINSIZ, "%2d cstyle", 1);
+        snprintf( outlin, LINSIZ, "%2d pstyle", style_no );
     ps_accu.push_back( outlin );
-    snprintf( outlin, LINSIZ-2, " %% (%s -> %s)", xco.c_str(), yco.c_str());
+    snprintf( outlin, LINSIZ-2, " %% (%s -> %s)", xco.c_str(), yco.c_str() );
     strncat( outlin, "\n", LINSIZ );
     ps_accu.push_back( outlin );
     for (uint i=0; i<np; i++) {
@@ -512,11 +513,11 @@ void NPlot::Dialog()
     }
 }
 
-void NPlot::gp_write(string in)
+void NPlot::gp_write( string in )
 {
-    // cout << "DEBUG gp_write " << in << "\n";
     string out = in + "\n";
-    write(gp_fifo, out.c_str(), out.size());
+    printf( "DEBUG GNUPLOT '%s'\n", out.c_str() );
+    write( gp_fifo, out.c_str(), out.size() );
 }
 
 void NPlot::ps_ticktack(uint ntack, double *tack, int ntpt, double *ticklim,
diff --git a/src/dualplot.h b/src/dualplot.h
index bd7bea8a425ccf091778eea3f9a5cc543225ef74..c064a81acd2023a48698d1c79da81f32e890ddf0 100644
--- a/src/dualplot.h
+++ b/src/dualplot.h
@@ -46,7 +46,7 @@ namespace NPlot { // additional declarations in dualplot.cpp
 
     void Clear();
     void Box();
-    void Line( const int lstyle, 
+    void Line( const bool as_line, const int style_no,
                const vector<double> x, const vector<double> y,
                const vector<double>* z,
                const string xco, const string yco,
diff --git a/src/edif.cpp b/src/edif.cpp
index 032a05fdbdecdc0f7e6308dae695f09429de8b00..e8f32e8bbb549e79d9510ccbb4cb3f560e079a68 100644
--- a/src/edif.cpp
+++ b/src/edif.cpp
@@ -954,11 +954,15 @@ void NEdif::Plot( bool add )
     const COld *fd;
     const COlc *fc;
     CScan S; 
+    static int pstyle = 0, cstyle = 0;
 	
     NOlm::JSelAsk( "Plot which scans", &JSel );
 
     if (!add) {
 
+        pstyle = 0;
+        cstyle = 0;
+
         // determine x-range ?
 		
         double inf, sup;
@@ -1058,7 +1062,6 @@ void NEdif::Plot( bool add )
     }
 
     // plot data:
-    int lstyle;
     NOlm::IterateEle eiter;
     while( (e=eiter()) ){
         k = eiter.SelNo();
@@ -1109,8 +1112,8 @@ void NEdif::Plot( bool add )
                     if( nyh )
                         printf( "  %d points > ymax\n", nyh );
                 } else {
-                    lstyle = 0;
-                    NPlot::Line( lstyle, fd->VS[j].x, fd->VS[j].y, e->Z(j),
+                    NPlot::Line( false, pstyle++,
+                                 fd->VS[j].x, fd->VS[j].y, e->Z(j),
                                  e->P()->xco.str(), e->P()->yco.str(),
                                  "data file "+strg(k)+" scan "+strg(j) );
                 }
@@ -1123,8 +1126,7 @@ void NEdif::Plot( bool add )
                     xp[i] = NPlot::X.R.plotcoord2value(
                         NPlot::X.log, i/(npts-1.0) );
                 fc->T->tree_curve_val_vec( &yp, xp, k, j );
-                lstyle = -1;
-                NPlot::Line( lstyle, xp, yp, e->Z(j),
+                NPlot::Line( true, cstyle++, xp, yp, e->Z(j),
                              e->P()->xco.str(), e->P()->yco.str(),
                              "curve file "+strg(k)+" scan "+strg(j) );
             } else if ( fc ) {
@@ -1153,7 +1155,6 @@ void NEdif::Plot( bool add )
                         s->Clear();
                     }
                     s->push_back( arg, val );
-                    printf( "DEB %g %g %g %i\n", pos, arg, val, SS.size() );
                 incr_pos:
                     was_inside = is_inside;
                     if( pos>= 1 )
@@ -1162,13 +1163,13 @@ void NEdif::Plot( bool add )
                     if( pos>1 )
                         pos = 1;
                 }
-                lstyle = -1;
                 for( int iS=0; iS<SS.size(); ++iS ){
-                    NPlot::Line( lstyle, SS[iS].x, SS[iS].y, e->Z(j),
+                    NPlot::Line( true, cstyle, SS[iS].x, SS[iS].y, e->Z(j),
                                  e->P()->xco.str(), e->P()->yco.str(),
                                  "curve file "+strg(k)+" scan "+strg(j)+
                                  " segment "+strg(iS) );
                 }
+                cstyle++;
             } else
                 throw string( "PROGRAM ERROR plot invalid *e" );
         }