Hi, Is there a plotting library for Fortran that I could (mis)use to (1.) “plot” a text at an x,y coordinate without any grid / background / backdrop being visible? Or (2.) even better: “plot” text against a gif background of my choice (to e.g. prompt at x,y for data entry)? Then I could create a nice user interface for an administrative application. Patrick.
Maybe, this is related
Thank you! Are you familiar with Dislin? If so, can it do what I am looking for?
Maybe PLplot. There is a plptex function which writes text inside the viewport.
A few others plotting libraries are listed here: Libraries for plotting data, handling images and generating user interfaces — Fortran Programming Language
And in the “Plotting and Graphics” section here: Libraries in Fortran Wiki
But “prompt at x,y for data entry” will be harder to found.
Am I understanding your text correctly, viz that it is possible to code a viewpoint and to position text at a desired x, y within that viewport? If so, that would be precisely what I am looking for, provided the size of the viewpoint is adjustable.
See that Fortran example:
They are drawing a few color strips, then put various texts inside.
I do not see a definition of the size of the window. Maybe it can be dynamically modified with the mouse? I don’t know.
I have been working with Dislin for a while now. Can you please share any picture or gif as an example here? Maybe that helps to get the idea.
Another option is gnuplot
.
You can plot text at a given location (plus other options) and get something like this:
The data file ('data.txt'
) for that plot consists of coordinates x, y, the string, and a rotation angle:
0 0 "O" 0
0 1 "N" 0
-1 0 "W" 90
1 0 "E" -90
0 -1 "S" 180
-0.5 0.5 "NW" 45
-0.5 -0.5 "SW" 135
0.5 0.5 "NE" -45
0.5 -0.5 "SE" -135
And the plot command is
plot 'data.txt' using 1:2:3:4:0 with labels rotate variable textcolor variable notitle
Of course a couple extra lines are needed to have a clean plot (such as no grid, no axes, the border can also be removed…).
As for the prompt x,y
, if you mean that the user is requested coordinates and a text to include in a(n existing) plot, it is doable. A plotting library with an input GUI would be the easiest, but you can get something similar with Fortran and gnuplot.
The triplet x, y, text
can be read in Fortran, written (appended) to a file (data.txt
), and used by gnuplot to (re)plot with each new entry (using e.g. call execute_command_line("gnuplot plotfile")
after each read/write). Then again, not sure if that’s exactly what you are looking for.
You can browse a few examples in the demos, under Text options
. Unicode text and 3D plots are also possible.
EDIT: Typo: it is gnuplot plotfile
, not gnuplot data.txt
.
plotfile
is the file where you write the commands plot
and others (for e.g. style), that is read by gnuplot.