1. I have been trying to find source for a VGA console driver for GNUPLOT
so as to use Gnuplot to view 'octave' graphs on my Linux console
(I'm not using X), with the graphics handled by svgalib.
I see references to "the Linux Driver" which suggest that this does
the job, but I can't find source. Can anyone help?
2. This is a tip for octave users who may find it impossible, difficult
or inconvenient to use 'gnuplot' to view graphs on their own screens
(especially non-users of X), or who would like access to greater control
over the plot, or far more enhancements, than 'gnuplot' provides.
The package GLE as distributed for Linux includes a VGA option (binary
file 'gle_vga', evoked by the command "gle -dvga"), which uses [s]vgalib
to display graphics on the screen.
GLE can be found in the sunsite.unc.edu Linux mirror as
apps/math/gle-3.3g-bin.tar.gz (include the binary files for vga)
apps/math/gle-3.3g-src.tar.gz (this does not include source for 'gle_vga')
The following three files, the first a skeleton command file for GLE,
the second a minimal m-file for 'octave', the third an 'octave' utility
to write column vectors and matrices out to a file, are all you need to
plot the columns 2..k of an Nxk matrix X as curves against column 1.
The octave command for this would be "glplot(X);" This function as
written returns value "1".
As written, you first see the GLE command-file for the plot. Press
F10 (or ^F 0) to see the graph. From the graph, "RETURN" gets you back
to the command file which you can edit to your taste and save under
another name for future reference. While viewing the graph, you can use
keys to move a cursor round the screen, draw lines, boxes; place text; etc.
All such changes cause corresponding commands to be automatically entered
into the command file you are viewing, and these too can be edited.
As the need arises and the mood takes me, I shall be making similar
arrangements to use GLE's surface-plotting and contouring functions
within 'octave', and will post these; if anyone beats me to it (quite
likely) it would be nice if they would do the same!
Ted Harding [hidden email] =======================================================================
This is a skeleton GLE file to plot columns 2..k of an Nxk data file
severally against column 1. There are various empty "sockets" for assorted
furniture: Ttitle, Xtitle, Ytitle, X2Title, Y1Title, box, table, key.
See the GLE Manual for the various options and enhancements which can be used.
Note that any textual item (e.g. Title) can include TeX-like specials
to get Greek, Math, sup/sub, etc.
size 24 18 box
set font pldr
begin scale 1 1
size 24 18
dn line marker square
This file drives GLE as the plotting software under Octave. The work-space
throughout is the current working directory.
Data must be in columns (you could modify the file to check this).
The first shell_cmd copies the above file 'gle_plot.gle' to the current
working directory (This seems necessary because GLE tends to treat "/"
as a switch, so doesn't recognise UNIX paths properly).
Replace the pathname in this command with wherever you decide to store
the file gle_plot.gle permanently.
function s = glplot(X)
% Plots the data in matrix X as graphs using 'gle'.
% The column X(:,1) is the set of x'values;
% the columns X(:,i) i=2..k give the y-values for the several curves.
shell_cmd("cp /usr/local/lib/octave/1.0/ted/gle_plot.gle .");
shell_cmd("gle -dvga gle_plot.gle > /dev/tty");
#H writes the data in the rows of matrices x1,x2,...
#H side-by-side into the rows of <filename> (APPEND mode).
#H 'format' is a C f,e or g format (e.g.'%7.4f') for a single number.
#H 'format' is mandatory, 'filename' is optional and, if omitted,
#H output is to the screen. If <filename> exists it is over-written
#H (to change this, change the commented line below)
#H There must be at least one matrix argument x1, and at most 10.
#H The matrices x1, x2, ... are output side by side; all must have the
#H same number of rows.
if isstr(fmt), strargs=2; end
if strargs==1, FIL="stdout"; X=fmt; FMT=file; P=1;
else X=; FMT=fmt; FIL=file; P=0; end
if (nargin-strargs)>P+0, X=[X x1]; end
if (nargin-strargs)>P+1, X=[X x2]; end
if (nargin-strargs)>P+2, X=[X x3]; end
if (nargin-strargs)>P+3, X=[X x4]; end
if (nargin-strargs)>P+4, X=[X x5]; end
if (nargin-strargs)>P+5, X=[X x6]; end
if (nargin-strargs)>P+6, X=[X x7]; end
if (nargin-strargs)>P+7, X=[X x8]; end
if (nargin-strargs)>P+8, X=[X x9]; end
if (nargin-strargs)>P+9, X=[X x10]; end
S=size(X); R=S(1); C=S(2);
fopen(FIL,"w"); % Change this to "a" to APPEND to an existing file
fprintf(FIL,FMT,X(i,j)), fprintf(FIL,' '), end, fprintf(FIL,'\n')
if (strargs==2) fclose(FIL); end
Ted Harding [hidden email]
here is my linux-svgalib driver i am using with gnuplot. I
hope it is the one you are looking for.
/* GNUPLOT - linux.trm */
* Copyright (C) 1993
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
* Permission to modify the software is granted, but not the right to
* distribute the modified code. Modifications are to be distributed
* as patches to released version.
* This software is provided "as is" without express or implied warranty.
* This file is included by ../term.c.
* This terminal driver supports:
* SVGA 1024x768x256 for PC's running the Linux Operating System
* (also VGA 640x480x16, and SVGA 800x600x256)
* Scott Heavner ([hidden email])
* based on original linux.trm by Tommy Frandsen ([hidden email])
* send your comments or suggestions to (pixar![hidden email]).
/* If SVGALIB is defined, it will compile with the Linux SVGAlib
* mainatained by Harm Hanemaayer ([hidden email]). SVGAlib 0.6
* supports Tridents, Tseng, Cirrus, Oak (?), and generic vga.
* If SVGALIB is not defined, it will attempt to use the trident
* tvgalib [hidden email].