PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8219 Location: Salford, UK
|
Posted: Sat Jul 12, 2025 8:51 am Post subject: |
|
|
John
The native %pl uses %gr so you can call draw_characters@ to draw text. Also link=columns can be used to present vertical columns.
The function GET_PLOT_POINT@ gets the pixel coordinates of a particular point relative to the axes.
Here is a simple example that calls draw_characters@...
Code: | WINAPP
MODULE mydata
USE clrwin
INTEGER,PARAMETER::n=1000,link_none=0,link_lines=1,link_curves=2
INTEGER,PARAMETER::all_graphs=0,graph1=0
LOGICAL shown
DOUBLE PRECISION y(n)
CONTAINS
INTEGER FUNCTION show()
INTEGER errstate
errstate = change_plot_int@(0,"link",graph1,link_curves)
if(errstate /= 0) print*, clearwin_string@("ERROR_REPORT")
errstate = change_plot_int@(0,"colour",graph1,RGB@(255,0,0))
errstate = change_plot_dbl@(0,"y_max",all_graphs,1.5d0)
shown = .true.
CALL simpleplot_redraw@()
show = 2
END FUNCTION show
INTEGER FUNCTION clear()
INTEGER errstate
call clear_screen@()
errstate = change_plot_int@(0,"link",graph1,link_none)
shown = .false.
CALL simpleplot_redraw@()
clear = 2
END FUNCTION clear
INTEGER FUNCTION legend()
IF(shown .AND. clearwin_string@("CALLBACK_REASON") == "PLOT_ADJUST") THEN
CALL draw_characters@("Legend:..", 300, 100, 0)
CALL draw_line_between@(300,120,360,120,RGB@(0,0,255))
ENDIF
legend = 2
END FUNCTION legend
END MODULE mydata
PROGRAM main
USE mydata
INTEGER i,x
DOUBLE PRECISION p1,p2,p3,z
!read*,i
p1=1.5d0
p2=150.0d0
p3=15d0
x=0
DO i=1,n
z=p1*sin(x/p3)*exp(-x/p2)
!print*, i-1,x,z
y(i) = z
x=x+1
ENDDO
shown = .false.
i=winio@('%ww[no_border]%ca[Damped wave]%pv&')
i=winio@('%mn[Edit[Show, Clear]]&', show, clear)
i=winio@('%fn[Tahoma]&')
i=winio@('%ts&', 1.1d0)
i=winio@('%tc&',rgb@(0,0,80))
i=winio@('%it&')
i=winio@('%`bg&',rgb@(230,255,225))
CALL winop@("%pl[native,gridlines]")
CALL winop@('%pl[title="Sample plot"]')
CALL winop@("%pl[x_axis=Time(Milliseconds)]")
CALL winop@("%pl[y_axis=Amplitude]")
CALL winop@("%pl[smoothing=4]") ! anti-aliasing
CALL winop@("%pl[link=none]") ! delay drawing
!CALL winop@("%pl[scale=log_linear]")
i=winio@("%^pl",500,400,n,0.0d0,1.0d0,y,legend)
END
|
I can look later for date routines if no one else knows how to do this. |
|