On Thu, Mar 27, 2008 at 15:52:58 -0400, H.S. wrote: > Hi, > > I have tried Gnuplot mailing list and the newsgroup but didn't get the > help I was looking for. So here my try there. > > Given a data file: > ######### 3cols.dat ######### > 0.2846 0.1857 1 > 0.8283 0.1330 2 > 0.3306 0.8348 3 > 0.7961 0.7968 4 > ############################# > > I want to plot the 2-D points given by first two columns in a color > given by the their label in the last column. The color doesn't matter, > only that points with a particular label are plotted with the same color. > > Here is what I have so far: > set pm3d > set palette rgb 33,13,10 > set view map > set cbrange [1:4] > ssplot "3cols.dat" with points palette pt 9 > > > However, a knowledgeable soul at the Gnuplot mailing list has informed > me that using pm3d is a bad idea (the above command spews out warnings > about not enough isosamples) and I should use 'plot' command for this. > But he did not follow that up with a little example.
The gnuplot list is no match for the vast and mysterious powers of debian-user... > So, can anyone here give an example using the plot command for this > purpose? This is on Debian testing, Gnuplot 4.2. For a small number of colors something like this is may be acceptable: # START unset key set xrange [0:1] set yrange [0:1] set multiplot plot "3cols.dat" using ($1):($3==1 ? $2 : 1/0) lt 1 plot "3cols.dat" using ($1):($3==2 ? $2 : 1/0) lt 2 plot "3cols.dat" using ($1):($3==3 ? $2 : 1/0) lt 3 plot "3cols.dat" using ($1):($3==4 ? $2 : 1/0) lt 4 unset multiplot # END To scale this up sensibly for many more colors, put the plot command into a separate file that is called as a subroutine from the main program. In this subroutine you can use a counter variable for both the $3 comparison and the lt assignment. After the plot command you can increment the counter and use the if/reread trick (see the manual) to make sure that the subroutine is re-executed as many times as is necessary to loop over all the colors. -- Regards, | http://users.icfo.es/Florian.Kulzer Florian | -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]