Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Turn off axes completely

11,339 views
Skip to first unread message

Rob Bowman

unread,
Dec 18, 2009, 11:06:21 PM12/18/09
to
Hi,
I'm doing a surface plot to a PNG file and I only want to see the surface -
I don't want the axes to be drawn. I have been playing with this for ages
but can't figure it out - please help!

Thanks :)

Stefan Nowy

unread,
Dec 19, 2009, 4:50:41 AM12/19/09
to

reset
unset border
unset xtics
unset ytics
plot x

HTH
Stefan

Rob Bowman

unread,
Dec 19, 2009, 4:06:26 PM12/19/09
to
Thanks very much! unset border is what I was missing.

Incidentally, I am calling pgnuplot from c# .net code, here's how I did it,
in case this can be of help to anyone (there's not a lot of info around on
this):

string strDirTmp = Environment.GetEnvironmentVariable("TEMP");

// Write ascii pixel data to a gnuplot matrix data file
string gpDataFileName = id + ".splot_dat.ascii";
string gpDataFileFullPath = strDirTmp + @"\" + gpDataFileName;
File.Delete(gpDataFileFullPath); // deletes data file if it
already exists
System.IO.StreamWriter sw = new
System.IO.StreamWriter(gpDataFileFullPath);
TDLog.T_WriteLine("Writing {0}x{1} pixel data to gnuplot ascii
matrix data file '{2}'", width, height, gpDataFileFullPath);
string str = "# gnuplot surface plot data for id '" + id + "'";
sw.WriteLine(str);
for (int x = 0; x < width; x++)
{
str = "";
for (int y = 0; y < height; y++)
str += data[y * width + x].ToString() + " ";
sw.WriteLine(str);
}
sw.Close();

// Start pgnuplot
string strDirGP = @"C:\gnuplot\bin"; // TODO - should not be
hardcoded
string gpExeFileFullPath = strDirGP + @"\pgnuplot.exe";
ProcessStartInfo psi = new ProcessStartInfo(gpExeFileFullPath);
psi.RedirectStandardInput = true;
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;

try
{
TDLog.T_WriteLine("Starting GNUPlot process '{0}'",
gpExeFileFullPath);
Process extPro = Process.Start(psi);

// Start a StreamWriter as a stdin pipe to pgnuplot
StreamWriter gpStWr = extPro.StandardInput;

// set plotting options
TDLog.T_WriteLine("Setting gnuplot plotstyle options");
gpStWr.WriteLine("reset");
gpStWr.WriteLine("title notitle");
gpStWr.WriteLine("set pm3d");
gpStWr.WriteLine("unset key");
gpStWr.WriteLine("set hidden3d");
gpStWr.WriteLine("set contour surface");
gpStWr.WriteLine("set dgrid 80 splines");
gpStWr.WriteLine("set view 60, 45, 1, 1.5");
gpStWr.WriteLine("unset border");
gpStWr.WriteLine("unset xtics");
gpStWr.WriteLine("unset ytics");
gpStWr.WriteLine("unset ztics");
gpStWr.WriteLine("unset colorbox");
gpStWr.WriteLine("set xyplane relative 0");
gpStWr.WriteLine("set terminal png enhanced transparent
truecolor");

// set the output file
string gpOutputFileFullPath = strDirTmp + "\\" + id +
".splot_out.png";
File.Delete(gpOutputFileFullPath); // deletes o/p file if it
already exists
gpStWr.WriteLine(@"set output '" + gpOutputFileFullPath
+"'");

// do the plot
TDLog.T_WriteLine("Plotting to file '{0}'",
gpOutputFileFullPath);
gpStWr.WriteLine(@"splot '" + gpDataFileFullPath + "' matrix
with lines");

// close gnuplot
gpStWr.WriteLine("quit");
gpStWr.Flush();

extPro.Close();
}
catch (Exception ex)
{
TDLog.T_DumpException(ex);
}

TDLog.T_WriteLine("Plot completed");

0 new messages