|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Thu Apr 09, 2020 10:15 am Post subject: |
|
|
I have reviewed this thread and here is a sample program that illustrates how to draw multiple titles at specified points on the graph.
Code: | WINAPP
MODULE mydata
USE clrwin
INTEGER,PARAMETER::n=1000
DOUBLE PRECISION y(n)
CONTAINS
INTEGER FUNCTION legend()
DOUBLE PRECISION xpix,ypix
IF(clearwin_string@("CALLBACK_REASON") == "PLOT_ADJUST") THEN
ir = get_plot_point@(400.0d0,1.4d0,xpix,ypix)
CALL italic_font@(0); CALL bold_font@(1); CALL scale_font@(1.1d0)
CALL draw_charactersD@("Sample plot", xpix, ypix, RGB@(0,0,128))
! **** More titles can go here ****
ENDIF
legend = 2
END FUNCTION legend
END MODULE mydata
PROGRAM main
USE mydata
INTEGER i,x
DOUBLE PRECISION p1,p2,p3,z
p1=1.5d0
p2=150.0d0
p3=15d0
x=0
DO i=1,n
z=p1*sin(x/p3)*exp(-x/p2)
y(i) = z
x=x+1
ENDDO
i=winio@('%ww[no_border]%ca[Damped wave]%pv&')
i=winio@('%fn[Tahoma]&')
i=winio@('%ts&', 1.1d0)
i=winio@('%it&')
i=winio@('%`bg&',rgb@(230,255,225))
CALL winop@("%pl[native,gridlines]")
CALL winop@("%pl[x_axis=Time(Milliseconds)]")
CALL winop@("%pl[y_axis=Amplitude]")
CALL winop@("%pl[smoothing=4]")
i=winio@("%^pl",500,400,n,0.0d0,1.0d0,y,legend)
END
|
|
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Apr 09, 2020 8:45 pm Post subject: |
|
|
thanks Paul,
which problem raised in the post does this specifically fix then?
I'd suggest that for the the example is a little misleading to say 'multiple titles', it should maybe be better expressed as 'how the label multiple points on a graph ' ?
A method similar to this method can of course be adapted for say legends, axes titles, etc ..... , PROVIDING it's possible to know the precise position available to put them WITHOUT overlaying on existing tics and labels labels , titles, etc ....
This was the subject of a seperate post of mine some time ago (which dan referred to in a comment he made in november on this thread)
That post can be found here:
http://forums.silverfrost.com/viewtopic.php?p=24330#24330
Also for legends it is often desired to put legends OUTSIDE a graphic area, especially when there are several curves present which utilise a large proportion of the graph 'box' and/or other 'component onject' of the overall plot
To do that requires again knowledge of things like margins, tics, axis labels parameters (to be able to pinpoint where to locate the user-defined DRAW_CHaracters@ text.
is it possible to provide examples for those scenarios .... if it's possible to do it that is ?
(I'm thinking here of an automated wat to do it without a trial-and-error approach for individual plots (whose axes, margins, acales and tic-labels might change as a function of the dataset to be plotted, thus requiring a program change each time !) _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|