FORTRAN SCREEN PLOTTING SUBROUTINES ****NOTE FOR MACS: I have not been able to get these to work with F90 on the Macs, evidentally because I cannot correctly link with the LeoLib C routines, which were compiled with the gcc compiler. EZXPLOT will work with F77 on the Macs using the free f77 compiler. In this case, the routines are in /home/shearer/PROG/PLOT/X and documentation is in ezxplot.man. You also will need to enter "setenv OPENWINHOME /usr/X11R6" which you may want to put into your .cshrc file. ************ The notes that follow apply to the Suns. It is often convenient to plot results directly to the screen. This is particularly true for designing interactive programs in which the user can digitize coordinates on the screen using the mouse. Unfortunately, there is no simple, well-documented language like Postscript for screen plotting. Most UNIX workstations support the X windows environment, but the manuals for plotting within X windows are not very user friendly. About 10 years ago, Guy Masters and I recognized the need for a library of subroutines that would enable us to plot in Fortran without having to deal with all of the X windows stuff. We hired Paul Parker (yes, Bob Parker's son, then in high school) to write some routines to handle the X windows interface. The result is the LeoLib package that can be found on the Fishnet at ~shearer/PLOT/X/PAUL/. These routines are written in C but their object file can be linked to Fortran programs. Using the LeoLib routines, I have written a set of Fortran subroutines called EZXPLOT that are very similar to the PSPLOT routines for generating Postscript files. Documentation for EZXPLOT may be found at ~shearer/PLOT/X/ezxplot.doc. To use these subroutines, link your program with: ~shearer/PLOT/X/ezxplotlib_f90.a (ezxplotlib.a for F77) ~shearer/PLOT/X/PAUL/LeoLib.0.9b/leolib.a (both F77 and F90) and with -L$$OPENWINHOME/lib -lX11 (links to the Sun OpenWindows library) Here is an example Makefile for the program testezxplot.f90 OBJS4 = /net/rock/shearer/PLOT/X/ezxplotlib_f90.a \ /net/rock/shearer/PLOT/X/PAUL/LeoLib.0.9b/leolib.a testezxplot: Makefile testezxplot.f90 $(OBJS4) f90 testezxplot.f90 $(OBJS4) -L$$OPENWINHOME/lib -lX11 -o testezxplot Here is the program itself, which demonstrates many of the EZXPLOT features: program testezxplot implicit none integer :: i, isymb, ibut real :: x, y character (len=80) :: xlabel call EZXINIT(700, 500) call EZXLOADFONT(i, '9x15') call EZXWIND(100., 600., 100., 400., 0., 10., 0., 10.) call EZXAXES(1.0, 2.0, 5, 'i3', 1.0, 5.0, 5, 'i3') xlabel = 'X-axis label' call EZXLAX(xlabel, 30, 'Y-axis label', 35) do i=1, 9 call EZXANG(float(i)*10.) x=float(i) y=5. call EZXMOVE(x, y) isymb=min(i, 6) call EZXCOL(i) call EZXSYMB(isymb, 5) call EZXLORG(i) call EZXLAB('text') call EZXCIR(x, y+2., (i+10)*2, i, 1) call EZXCIR(x, y-2. ,20, i, 0) call EZXCOL(1) enddo call EZXMESS('Hit mouse key to digitize') call EZXDIG(x, y, ibut) print *,'x, y, ibut = ', x, y, ibut call EZXQUIT end program testezxplot When using both PSPLOT and EZXPLOT, please remember the following differences: (1) Absolute position coordinates (e.g., the first four arguments of EZXWIND and PSWIND) are in integer pixels for EZXPLOT, but are in real inches for PSPLOT. (2) EZXDUMP is a simple bitmap dump of the screen. Thus, it does not have the resolution of Postscript files with direct move and draw commands. (3) Large time series are drawn fastest using the EZXPOLY command rather than a series of EZXDRAW commands. There is no PSPLOT equivalent. (4) Points can be digitized using the EZXDIG command. There is no PSPLOT equivalent. (5) There is no way to perform general fill operations within EZXPLOT. (6) It's EZXNUM and PSNUMB (extra B). Don't ask me why. ASSIGNMENT SCREEN1 Use the EZXPLOT routines to write a program to do the following: (1) Draw a large box on the screen (2) Digitize a series of points from the user. If the point is outside the box, terminate the program. If the point is inside the box, then perform the following depending upon which mouse button is pushed: (a) Mouse button 1: Move (without drawing) to the point (b) Mouse button 2: Draw a line to the current point (c) Mouse button 3: Input from the keyboard some text and plot this at the current point. (d) Mouse button 4 (button 1 with shift key): Change color to red. (e) Mouse button 5 (button 2 with shift key): Change color to blue. (f) Mouse button 6 (button 3 with shift key): Change color to black.