Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

XY-plot with fortran

gsfantos
Beginner
2,451 Views

Hi there,

I have to sets of X-Y data and I am trying to plot them using fortran, just to have a fast view of my results. However I don't have a clue how to create an x-y plot that would have two sets of data and that I could change every time my data and re-plot. The quality of the plot is not a major concern. Any suggestions?

Thanks a lot in advance

George

0 Kudos
5 Replies
anthonyrichards
New Contributor III
2,451 Views

Do you want a dialog-based program that offers buttons to
1) read data from a file
2)offer to plot the data in a window?
or a program that both generates the data and then plots it in a window?
Something like the one shown in the attachment?

0 Kudos
gsfantos
Beginner
2,451 Views

Thanks for your quick answer. My code generates the data and I would like to plot them automatically. Then the code is asking me if I want to change something and if yes I am going back , I am changing a parameter and a new set of data is produced which again I would like to plot them automatically. Just this. Your attachment bytheway looks very impressive!!

Thanks again

George

0 Kudos
anthonyrichards
New Contributor III
2,451 Views

The screenshot was of a dialog-based program made using Compaq Visual Fortran 6.6C.
The plot you see was drawn on a static text control given the OWNERDRAW style as follows (taken from
a post by Jugoslav Djugic) by first adding the control from the menu supplied by the resource editor then closing the resource file, then going into the resource file, opening it in the editor as atext file and editing it directly...then saving it and opening it as 'auto', when the control should now be visible as a 'hole' in the dialog!

(excerpt from Jugoslav's archived post begins).
"..Nevertheless, I think it's clearer to do the drawing in an owner-
drawn static control. So, make IDC_PLOTWINDOW an owner-drawn static control
Unfortunately, Visual Studio 5 (nor 6, as I checked) does not have "Owner drawn" check-box for static control on property sheet. You have to edit .rc file manually later - add SS_OWNERDRAW style to your control:

CONTROL "",IDC_PLOTWINDOW,"Static",SS_OWNERDRAW,11,16,116,120
(excerpt ends)

You might try modifying the style still further as follows:

CONTROL"",IDC_PLOTWINDOW,"Static",SS_OWNERDRAW | SS_SUNKEN | WS_GROUP,
175,0,269,192
(Make no other changes to the resource file, or you risk screwing it up, in fact it is a good idea to create a copy of it BEFORE you edit it, just in case, so that you can get back to normal if you do screw up accidentally.)

I then add Jugoslav's XFLOGM module into my project, add USE XFLOGM whereverI set up dialog callbacks and, for the static ownerdrawn control, add a callback for DLG_DRAWITEM that XFLOGM generates when windows issues a WM_DRAWITEM message.

USE XFLOGM
INCLUDE 'RESOURCE.FD'

EXTERNAL OnOwnerDraw

retlog=DlgSetSub(dlg,IDC_PLOTWINDOW,OnOwnerDraw,DLG_DRAWITEM)

I attach a zipped and edited version of an OnOwnerDraw call-back routine to show how it could work, as well as my old copy of XFLOGM (thanks, Jugoslav!)...

Best of luck

0 Kudos
wpitts
Beginner
2,451 Views
This is off topic, but are you trying to do some sort of nonlinear data fit? If so, then there are many FORTRAN subroutines that will help you with this.

War Eagle

0 Kudos
jmloriot
Beginner
2,451 Views

Hi

I have done it using movetoEX and MSFWIN$LineTo functions and that is very easy.

But it took me quite a long time to access the printer.

Let me know if you want my source code

Jean-Marc

0 Kudos
Reply