|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7934 Location: Salford, UK
|
Posted: Thu Sep 25, 2014 7:04 am Post subject: |
|
|
In theory it would be possible for us to make changes to the ClearWin+ interface for %pl but we do not have the source code for SIMPLEPLOT. In any case, with so many other demands on our time, it seems unlikely that we will be able to make any changes in the short to medium time frame. |
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Thu Sep 25, 2014 5:23 pm Post subject: |
|
|
well....this means that we are in a dead point......at least for the short and medium time frame....in the meanwhile Dan, I can offer you the alternative solution if you need a greater versatility with your graphs (i.e. different outputs). See the following code: Code: | module funciones
integer xx,yy,resize
integer*4 ans
real*4 x(100), y(100), z(100), u(100), v(100), w(100),max_y,min_y
real*4 ymin,ymax,zmin,zmax,umin,umax,vmin,vmax,wmin,wmax
real*8 ::TextSize=0.4
integer*4 :: iLineTrace=0, iLineColor=1, iLineWidth=4
integer :: iCharacterSetNo = -11,iOrientation=2
integer :: newLineTrace=0,newLineColor=1,newLineWidth=4,nplot=0
real*8 :: LeftMrgn=2.0, RightMrgn=0.5, BottomMrgn=2.0, TopMrgn=1.0
type plot
integer ::LineTrace=0
integer ::LineWidth=0
integer ::LineColor=1
end type plot
type(plot), dimension(5) :: curve
contains
integer function bitmap()
use spwin
use mswin
resize=clearwin_info@('GRAPHICS_RESIZING')
IF(resize.EQ.1)THEN
xx=clearwin_info@('GRAPHICS_WIDTH')
yy=clearwin_info@('GRAPHICS_DEPTH')
HDC_DIM%iWidth = xx
HDC_DIM%iHeight = yy
HDC_DIM%iBitmapDC=clearwin_info@('GRAPHICS_DC')
endif
CALL SP_SupplyBitmap ! Pass Bitmap to SIMPLEPLOT
call plot_curves
call updatewin
bitmap=1
end function bitmap
subroutine plot_curves
if(nplot/=0) then
curve(nplot)%LineWidth=newLineWidth
curve(nplot)%LineTrace=newLineTrace
curve(nplot)%LineColor=newLineColor
curve(nplot)=plot(newLineTrace,newLineWidth,newLineColor)
else
iLineTrace=0;iLineColor=1;iLineWidth=4;LeftMrgn=2.0;RightMrgn=0.5;BottomMrgn=2.0;TopMrgn=1.0
iCharacterSetNo = -11;iOrientation=2
curve(1)=plot(0,4,1)
curve(2)=plot(0,4,2)
curve(3)=plot(0,4,3)
curve(4)=plot(0,4,4)
curve(5)=plot(0,4,5)
endif
CALL PICMRG(sngl(LeftMrgn),sngl(RightMrgn),sngl(BottomMrgn),sngl(TopMrgn)) ! set PICture MaRGins!
CALL DIAGLV (0) ! suppresses creation of MESSAGES.TXT file
call pagvw(iOrientation)
CALL TEXTMN(sngl(TextSize))
CALL AXLBJS('*C','C')
call chset(iCharacterSetNo)
N=100
do i=1,N;
x(i)=i-1;
y(i)=sin(i/30.)**2;
z(i)=sin(i/30.)**5;
u(i)=sin(i/30.)**10;
v(i)=cos(i/30.)**10;
w(i)=sin(i/30.)**2 * cos(i/30.)**2;
enddo
call limexc(y,n,ymin,ymax)!max and min values of y,z,u,v,w...
call limexc(z,n,zmin,zmax)
call limexc(u,n,umin,umax)
call limexc(v,n,vmin,vmax)
call limexc(w,n,wmin,wmax)
max_y=max(ymax,zmax,umax,vmax,wmax)
min_y=min(ymin,zmin,umin,vmin,wmin)
CALL DIAGLV (0)
call pgfull(.true.)
call setpns(1,1,1,1)!reset the pen colours before redrawing
CALL AXLBJS('*C','C')
call axsbtk('XC','I')
call axsbtk('YC','I')
CALL SCALES(0.0,100.0,1,min_y,max_y,1)
call thckmg('LINE', 2.0)
call axes7('time','Amplitude')
CALL AXLBJS('*C','C')
call thckmg('LINE', float(curve(1)%LineWidth))
call pen(curve(1)%linecolor)
CALL BRKNCV(x,w,N,curve(1)%LineTrace)
call thckmg('LINE', float(curve(2)%LineWidth))
call pen(curve(2)%linecolor)
CALL BRKNCV(x,y,N,curve(2)%LineTrace)
call thckmg('LINE', float(curve(3)%LineWidth))
call pen(curve(3)%linecolor)
CALL BRKNCV(x,z,N,curve(3)%LineTrace)
call thckmg('LINE', float(curve(4)%LineWidth))
call pen(curve(4)%linecolor)
CALL BRKNCV(x,u,N,curve(4)%LineTrace)
|
|
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Thu Sep 25, 2014 5:27 pm Post subject: |
|
|
(follows here)
Code: |
call pen(curve(4)%linecolor)
CALL BRKNCV(x,u,N,curve(4)%LineTrace)
call thckmg('LINE', float(curve(5)%LineWidth))
call pen(curve(5)%linecolor)
CALL BRKNCV(x,v,N,curve(5)%LineTrace)
end subroutine plot_curves
integer function change_plot()
use spwin
if(nplot==0) then
call plot_curves
call updatewin
else
newlineWidth = curve(nplot)%LineWidth
newLineTrace = curve(nplot)%LineTrace
newLineColor = curve(nplot)%LineColor
call updatewin
endif
change_plot=1
end function change_plot
integer function reset_plot()
use spwin
nplot=0
call plot_curves
call updatewin
reset_plot=1
end function reset_plot
integer function select_output()
call OWNNEW(.true.)
call devnam("")
call plot_curves
call endplt
select_output=1
end function select_output
end module funciones
program Resized_Simpleplot_plots
use mswin
use spwin
use funciones
ans=winio@('%sy[3d_raised]%ca[Fine control of plots attributes with Simpleplot]%bg[grey]&')
ans=winio@('%il&', -12,26)
ans=winio@('%taCharset %dd%6^rd& ', 1, iCharacterSetNo, bitmap)
ans=winio@('%fl&', 0.0D0,10.0D0)
ans=winio@('%taText size %df%6^rf& ', 1d-2, TextSize, bitmap)
ans=winio@('%il&', 2,7)
ans=winio@(' Orientation %dd%6^rd& ', 1, iOrientation, bitmap)
ans=winio@(' L R B T margins %df%6^rf%df%6^rf%df%6^rf%df%6^rf%ff&', 5d-1,LeftMrgn, bitmap, &
5d-1,RightMrgn, bitmap, 5d-1,BottomMrgn, bitmap, 5d-1,TopMrgn, bitmap)
ans=winio@('%il&', 0,5)
ans=winio@('%nl%taPlot%ta%dd%6^rd&',1,nplot,change_plot)
ans=winio@('%ta Line width %dd%6^rd& ', 1, newLineWidth, bitmap)
ans=winio@('%il&', -6,6)
ans=winio@(' Line trace %dd%6^rd& ',1,newLineTrace,bitmap)
ans=winio@('%il&', 0,26)
ans=winio@('%taLine color %dd%6^rd%ff& ',1,newLineColor,bitmap)
ans=winio@('%2nl%cn%ww%pv%^dw[user_resize]&',800,600,bitmap) ! Pass bitmapDC to ClearWin
ans=winio@('%ff%nl%cn%6bt[Close]%2ta%6^bt[Print]%2ta%6^bt[Reset]',select_output,reset_plot)
end program resized_simpleplot_plots
|
it allows you to "Print" and setup your printer, or to select a different output such as a new window, a windows metafile, etc......and I have been playing with the code in a way that you can change the atributes of each plot or reset all to the initial conditions...I guess you can do the same with %pl, EXCEPT to print the graph.....
Agustin |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2828 Location: South Pole, Antarctica
|
Posted: Fri Sep 26, 2014 3:40 pm Post subject: |
|
|
Thanks Agustin. May be some day i will need that but you know my problem is that i do not want to touch and use so far dead buggy graphics language. As Paul mentioned that they still do not have access to the SP sources that means nothing but the
*** death of Simpleplot ***
As you have seen above i have written my own graphics package. I also used some Simpleplot %sp due to its simplicity. But i will rewrite everything into own graphics if the destiny of sources will not be addressed.
BTW, have you also noticed that if you save screen into Windows metafile the fonts are substantially changed to the worse from what we see on the screen? |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Sep 26, 2014 3:57 pm Post subject: |
|
|
Nice work Agustin, except I don't get any Close-Print-Reset buttons when I tried to run your last code !
I have the Clearwin drawing surface which goes right to the bottom of the window with NO buttons below it.
What is the compile/link command you use ?
For some reason the ticks are now inside the axes, is that deliberate to avoid 'touching' with tick labels ?
Apart from that, try playing with the margins as follows .... keep increasing the RH margin width and you'll see the LH axis label eventually 'flips' inside the plot. Similar when you increase the upper margin, the x-axis label will flip inside.
I thought (somehow) you had resolved the problem I mentioned before but clearly the relation between window size-page size and margins is more complex. |
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Fri Sep 26, 2014 4:04 pm Post subject: |
|
|
your welcome Dan!......in my case I will continue using Simpleplot because is the only one I found that can be used with Clearwin in a %dw window.....I have given a look at DSLIN but it seems to have no chance of interfacing with Clearwin, which for me is important if one is developing a program as a Windows application.....I still have some expectancies that Simpleplot will return (like James Bond ) in a not so far future......who knows?
as for the windows-metafile.....well......my results are different.....I get what I see in the window.....same fonts.....I do not know why you get different results......at least using the code I put yesterday.....
Agustin |
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Fri Sep 26, 2014 4:16 pm Post subject: Re: |
|
|
John-Silver wrote: | Nice work Agustin, except I don't get any Close-Print-Reset buttons when I tried to run your last code !
I have the Clearwin drawing surface which goes right to the bottom of the window with NO buttons below it. |
that's quite strange because the last line of my code clearly states:
ans=winio@('%ff%nl%cn%6bt[Close]%2ta%6^bt[Print]%2ta%6^bt[Reset]',select_output,reset_plot)
so the buttons should be there......
Quote: | For some reason the ticks are now inside the axes, is that deliberate to avoid 'touching' with tick labels ? |
that's because I use now: call axsbtk('YC','I') and call axsbtk('XC','I')
Quote: |
Apart from that, try playing with the margins as follows .... keep increasing the RH margin width and you'll see the LH axis label eventually 'flips' inside the plot. Similar when you increase the upper margin, the x-axis label will flip inside.
I thought (somehow) you had resolved the problem I mentioned before but clearly the relation between window size-page size and margins is more complex. |
yes, let me check that.....
Agustin |
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Fri Sep 26, 2014 5:52 pm Post subject: |
|
|
Quote: | Apart from that, try playing with the margins as follows .... keep increasing the RH margin width and you'll see the LH axis label eventually 'flips' inside the plot. Similar when you increase the upper margin, the x-axis label will flip inside.
I thought (somehow) you had resolved the problem I mentioned before but clearly the relation between window size-page size and margins is more complex. |
I found the problem!.....in the last version of the code, I added the call to PGFULL(.TRUE.), which maximised the size of the picture but at the cost of moving the periphery to the picture margins....and as Simpleplot needs a margin for depicting scales and legends, once the individual margins are moved by the user in such a way that there is no enough margin for legend and labels, Simpleplot moves them to the inside of the picture!.....Simpleplot just obeys the user: move the margin but at the same time put the programmed labels and legend .....so he tries the best he can.....therefore, just remove the call to PGFULL and problem solved!....I do not remember at which stage I decided to add that statement.....sometimes one writes first and thinks after....
Agustin |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Sep 26, 2014 8:14 pm Post subject: |
|
|
Solved my problem with the non-appearing menus.
My screen is only 800 pixels deep.
I decreased the depth of the %dw window (bitmap) to 500 and the menus appeared !!!
It seems that if this happens, even when you reduce the size of the window by hand the buttons don't appear.
Have to take care of the window not descending into the windows task bat too.
Regarding Margins -
Interesting regarding setting the PGFULL. It worked fine, I'll have to read your explanation line 10 times, slowly, though for it to sink in ! I've been struggling with understanding all the margins settings for a while now to try to understand exactly this problem, which Dan also sees in his code.
One odd thing still happens - try setting all the margins to zero first.
Then, increase the TOp margin and you'll see that it descends the top of the graph area and the bottom remains the same.
If you now do the same with the RH margin (increase it) the same will happen, up to a point where the LH margin ALSO starts to move inwards with it !!! Strange. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Sep 26, 2014 8:18 pm Post subject: |
|
|
almost forgot, another interesting thing is that if you 'print' to DIB (i.e. .bmp) there is a margin printed with it, but if you choose Metafile (.WMF) there are absolutely no margins and sometimes the text (e.g. x-axis rh end label) and curves (at top) are actually on the edge of the image.
oh, and how exactly do you compile/link, what command, as I get mixed up trying to keep the SPWIN file seperate to the main file. I do an ftn first then slink seperately. Seems I have to not only compile that file (creating the .MOD) but also link it on it's own first (to get .obj) before then linking it with the main prog obj and the simple.dll, making sure the spwin.obj is the first file in the list.
I'm not sure exactly why, but it ob�nly works that way, if I put it at the end it doesn't link properly (errors- can't find DDDATA, etc...) |
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Sat Sep 27, 2014 12:06 am Post subject: |
|
|
which application are you using to open the .wmf file?......for instance, with Irfanview I see what you see, but with mspaint not......I have not tried to print the metafiles, so I do not know how they look when printing...but seems to be a question of the viewer...in fact if you import the .wmf file for instance into a Word document, you will see (I hope so...) that there is a margin around the graph....
about compiling: I use Plato, so that I open the Project Explorer, add SImpleplot.dll as reference file, then compile the Simpleplot module (spwin) first and then the working file...that's all...
Agustin |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Sat Sep 27, 2014 2:27 pm Post subject: |
|
|
Thanks for spotting that Agustin.
Yes, I use Irfanview (imo one of the best of these multi-function image programs).
Interesting that the border disappears.
Nothing specific on the Irfanview forum about this particular problem although I did see something about there being different 'standards' for .wmf files and maybe it doesn't deal with it correctly.
A bit of a 2-edged sword really as imo it would be nice to have the option to cut-paste into a word document WITHOUT the outer border as it would allow for more compact packing say 4 or 6 plots on a page giving the user the flexibility to introduce spacing as and when he wishes (always a trade-off of course between readability, document length and figure labelling of course). |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2828 Location: South Pole, Antarctica
|
Posted: Sun Sep 28, 2014 5:25 pm Post subject: |
|
|
And look how %pl plots LOG_LOG scale... hahahah... I'll get mental problem with this S#$%plot...Look at this X axis jumping off-lined numbering
Code: | !-------------------------------------------------------------------
! Program Simple2
! Compilation:
!>ftn95 aaa.for /free /debug /undef
!>slink aaa.obj "c:\Program Files (x86)\Silverfrost\FTN95\SIMPLE.DLL"
!
! With thanks to Agustin "Aebolzan" and John "John-Silver"
! of the Fortran forum forums.silverfrost.com
! for bringing almost dead Simpleplot to life
!-------------------------------------------------------------------
!
Module SomeFun
INCLUDE <windows.ins>
real*8 TextSize
integer LineWidth, iCharacterSetNo, iOrientation, LWindow
real*8 LeftMrgn, RightMrgn, BottomMrgn, TopMrgn
Real*8 x(1001), y(1001), z(1001), u(1001), v(1001), w(1001)
CONTAINS
!--------------------------------------------------------------------
integer function RedrawS ()
CALL DIAGLV (0)
call pagvw(iOrientation)
! set PICture MaRGins L R B T
CALL PICMRG(sngl(LeftMrgn),sngl(RightMrgn),sngl(BottomMrgn),sngl(TopMrgn))
CALL TEXTMN(sngl(TextSize)) ! 45)
CALL AXLBJS('*C','C')
call thckmg('LINE', float(LineWidth))
call chset(iCharacterSetNo)
call simpleplot_redraw@
RedrawS = 2
End function
End Module SomeFun
!===============================================!===================================================================
Program Simple2
use SomeFun
TextSize = 0.41
LineWidth = 2
iCharacterSetNo=-11
iOrientation = 2
LeftMrgn=2.5; RightMrgn=0.5; BottomMrgn=3.0; TopMrgn=1.0
N=999
A=1 ! 20000
do i=1,N;
x(i)=i! -1;
y(i)=A*sin(i/30.)**2;
z(i)=A*sin(i/30.)**5;
u(i)=A*sin(i/30.)**10;
v(i)=A*cos(i/30.)**10;
w(i)=A*sin(i/30.)**2 * cos(i/30.)**2;
enddo
i=winio@('%ww%sy[3d_raised]&') ! %bg[grey]
i=winio@('%1tl%nd%nr&',16)
i=winio@('%2.1ob[invisible,bottom_exit]&')
i=winio@('Text size %ta%df%6^rf%ff&', 1d-2, TextSize, RedrawS)
i=winio@('Line Width %ta%dd%6^rd%ff&', 1, LineWidth, RedrawS)
i=winio@('%cb&')
i=winio@('%taCharset (-12 to +26)%ta%dd%6^rd&', &
1, iCharacterSetNo, RedrawS)
i=winio@(' Orientation (2 to 7) %dd%6^rd%ff&', &
1, iOrientation, RedrawS)
i=winio@('%taL R B T margins %ta%df%6^rf%df%6^rf%df%6^rf%df%6^rf%ff&', &
5d-1,LeftMrgn, RedrawS, 5d-1,RightMrgn, RedrawS, &
5d-1,BottomMrgn, RedrawS, 5d-1,TopMrgn, RedrawS)
i=winio@('%cb&')
i=RedrawS()
i=winio@('%ww%pv%pl[x_axis="Time [s]",y_axis=Amplitude,&
&title="U (red), U_A (orange), I (blue) ", &
& colour=red, colour=blue, colour=green, colour=black, &
&colour=#CC8800, X_ARRAY, SCALE=LOG_LOG, N_GRAPHS=5]&',& ! =LINEAR
& 800, 600, N, x, y, z, u, v, w)
i=winio@('%ac[esc]%ff&', 'exit')
i=winio@('%cn%^6bt[E&xit]','exit')
End Program
|
|
|
Back to top |
|
|
aebolzan
Joined: 06 Jul 2007 Posts: 229 Location: La Plata, Argentina
|
Posted: Sun Sep 28, 2014 8:33 pm Post subject: |
|
|
I think that it would be interesting to know who created the %pl window and how could he designed it without having the Simpleplot code.....
I found some funny things between %pl and %dw: for instance, I was using PICMRG for setting the margins, but....PIC means "pictures", so that PICMRG was designed for setting the margins of the pictures inside the page of a graph....I have now used the (I think) more apropriate PAGMRG and I can set the margins without moving the graph towards the north-east when the margins become too restrictive (an effect noticed by John). However, PAGMRG does not work under %pl, only PICMRG...it sound like %pl works with the "picture", not with the "page" of Simpleplot......In fact, using Simpleplot I could depict 4 pictures inside a single page, as I am using Simpleplot subroutines, but with %pl you can plot only a single picture.......this is certainly a strong limitation of %pl.....
From the Simpleplot manual: "By default, the peripheral margin around a group of pictures is treated as two pairs of complementary margins (left/right and bottom/top) and each pair is distributed in a 2:1 ratio, left:right and bottom:top. PAGMRG specifies the size and distribution of these peripheral margins individually. "
The default margins, according Simpleplot, are restored by putting -1 in L,R,B and T....with a left margin of 0 it means that the axes goes to 0 and as there is no place for the legend and the labels, Simpleplot does the only thing that can be done: put the text inside the graph, i.e. after the axes....it could be sound strange, but it is a natural response for an 'unnatural' request from the operator.....
another interesting point is: Simpleplot allows log-log axis, but if the "x" or "y" arrays includes the value of 0.0, Simpleplot naturally refuses to plot a log and authomatically changes to linear scale the request of a log scale. In the case of %pl......well...%pl allows to plot a graph from an array that includes the value of zero....how %pl overrides SP restrictions?, I do not know....
Dan: you can use "call AXLBLV ('XC', 1)" if you like to have only powers of 10 in the log axis.....but I have no clue about how to move the labels a little bit downwards in order to look nicer.....sorry...
Agustin |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2828 Location: South Pole, Antarctica
|
Posted: Sun Sep 28, 2014 9:46 pm Post subject: |
|
|
Thanks Agustin for the suppression of numbering between decades tip.
As to adjusting positions of numbering i remember I wrote email ~1.5 decades ago to developers of Simpleplot and got the respond that everything is possible there (without specifying how). Please continue hacking, seems that is the only way to use this half-tuned abandoned to die slowly soft |
|
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
|