forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hershey fonts available for Simpleplot
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Mon Sep 29, 2014 5:09 pm    Post subject: Reply with quote

Gentlemen, Welcome to the wonderful World of Margins Smile !!!
As you're beginning to see, nothing is as it seems ... or so it seems ... Smile
Remember though , that SimplePlot tries to be too clever for it's own good in 'automatically' re-adjusting things when the many parameters 'conflict'.
I'm still trying to get my head around it all.
Agustin, as well as Picture Margins and Page Margins there is Periphery, and also Group Margins.
You're probably right about %pl only plotting single graphs. For most that's all that's required I guess (doesn't mean it shouldn't be an option though).

As for log scales, the 3/30/300 look like they might be 'specific labels (but why they have been put there is anyones guess) since they are aligned differently (lower, better) than the major tick labels.

My heads hurting because, as an F77 stalwart, I'm struggling with some of the constructs you've thrown into your code Agustin !

What on earth are these lines like (cut n pasted at random) .....

type(plot), dimension(5) :: curve
newlineWidth = curve(nplot)%LineWidth
curve(nplot)%LineTrace=newLineTrace
curve(nplot)=plot(newLineTrace,newLineWidth,newLineColor)

... all about ???????
What's wrong with IF's and DO's all of a sudden in Fortran !Wink
(I'm sure Eddie's with me on this one !)
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Mon Sep 29, 2014 5:47 pm    Post subject: Re: Reply with quote

John-Silver wrote:
Gentlemen, Welcome to the wonderful World of Margins Smile !!!
As you're beginning to see, nothing is as it seems ... or so it seems ... Smile
Remember though , that SimplePlot tries to be too clever for it's own good in 'automatically' re-adjusting things when the many parameters 'conflict'.
I'm still trying to get my head around it all.
Agustin, as well as Picture Margins and Page Margins there is Periphery, and also Group Margins.


Yes, I know, but I tried not to play with them because it would complicate the menu....

Quote:

You're probably right about %pl only plotting single graphs. For most that's all that's required I guess (doesn't mean it shouldn't be an option though).


I guess that the original idea of %pl was just to give the user a simple and fast way for plotting some data in a cartesian plot (see that there is no way to plot a surface, an histogram, a pie, etc., UNLESS you use the option user_drawn in %pl with a call-back function...).....and for a more complex graphs was of course the "elegant" solution of using %dw with the full power of Simpleplot.....in this sense, I find more useful to update Simpleplot than to increase the complexity of %pl, but it just my opinion.....

Quote:

As for log scales, the 3/30/300 look like they might be 'specific labels (but why they have been put there is anyones guess) since they are aligned differently (lower, better) than the major tick labels.


this is what I mean when I say that Simpleplot needs an update.....the way it manages fonts is not quite right......

Quote:

What on earth are these lines like (cut n pasted at random) .....

type(plot), dimension(5) :: curve
newlineWidth = curve(nplot)%LineWidth
curve(nplot)%LineTrace=newLineTrace
curve(nplot)=plot(newLineTrace,newLineWidth,newLineColor)


well, that's Fortran 90.....I defined a derived data type variable in order to group together all the information about each curve.....each variable works like an array that can have many components but unlike an array, the component of a derived data type may have different types (integer, real, character, etc.).......I find this more straightforward and useful than defining arrays for line width, line colour, line type, etc......

Agustin
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Tue Sep 30, 2014 10:51 am    Post subject: Reply with quote

I don't think the log-log happenings are a specifically %pl originated problem.
Modifying your last code Agustin (i.e. no %pl) with: CALL SCALES(1.0,100.0,2,0.1,1.0,2) , for example gives
a similar effect on both axes to that seen with Dan's code.
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Tue Sep 30, 2014 2:37 pm    Post subject: Reply with quote

Yes, you are right...I did not see that Dan modified his original code and set x(i)=i instead of x(i) = i-1......

Agustin
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Oct 01, 2014 5:10 pm    Post subject: Reply with quote

???? how does that affect log axes labelling ???
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Wed Oct 01, 2014 5:27 pm    Post subject: Reply with quote

It should not affect the labelling...it affects the type of axis...if Simpleplot detects that the data includes the value of zero, it uses a linear scale instead of a log one.....if Messages.txt is allowed (if you avoid de call DIAGLV(0)), Simpleplot sends the following diagnostic: "Range through 0; linear scale used" .

Agustin
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1554
Location: South Pole, Antarctica

PostPosted: Thu Oct 16, 2014 11:54 pm    Post subject: Reply with quote

There exist few more annoyances in Simpleplot. Like inability to use real*8 numbers despite they are declared as real*8. Try a=1d55 - it causes floating point violation.
Or sensitivity to initial data used which causes crash with "exception" diagnostics (and you scratch the head why it crashes. ). Try do i=1,100 instead of do i=1,1001
There exist one more problem which is superannoying. Try to make also array limit changeable and update the plot with simpleplot_redraw@. It does not work at all. In the code below versus previous one i just added adjustable size of arrays Ncurr for Simpleplot to plot
....800, 600, Ncurr, x, y, z, u) instead of fixed size N=999 in the past ....800, 600, 999, x, y, z, u)
to show that this does not work when you change it (click on red box). I may miss something, if not i hope this is fixable issue without Simpleplot source code. To work correctly i always close existing and open new window with %pl in it. Also hope fixable is Clearwin+ own minor bug in %tl when you try to use TAB size lower then 8 it also does not make any effect -see the arrow.
Code:
! Compilation:
!>ftn95 aaa.for /free /debug /undef
!>slink aaa.obj "c:\Program Files (x86)\Silverfrost\FTN95\SIMPLE.DLL"
 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)
 integer Ncurr
 CONTAINS
 integer function RedrawS ()
 CALL DIAGLV (0)
 call AXLBLV ('XC', 1) ! to not plot in log intemediate numbering
 call pagvw(iOrientation)
 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 Simple3
 use SomeFun
 real*8 A
 TextSize    = 0.41
 LineWidth    = 3
 iCharacterSetNo=-11   
 iOrientation   = 2
 LeftMrgn=2.5; RightMrgn=0.5; BottomMrgn=3.0; TopMrgn=1.0
 A=1d5
 Ncurr = 1001
 do i=1, 1001
   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;
 enddo
 i=winio@('%ww%sy[3d_raised]&') ! %bg[grey]
 i=winio@('%1tl%nd%nr&',4) !  <-------- does not work
 i=winio@('%2.1ob[invisible,bottom_exit]&')
 i=winio@('Text   size   %ta%df%4^rf%ff&', 1d-2, TextSize, RedrawS)
 i=winio@('Line Width %ta%dd%4^rd%ff&', 1, LineWidth, RedrawS)
 i=winio@('%cb&')
 i=winio@('%taCharset  (-12 to +26)%ta%dd%4^rd&', &
          1, iCharacterSetNo, RedrawS)
 i=winio@('  Orientation  (2 to 7)    %dd%4^rd%ff&', &
          1, iOrientation, RedrawS)
 i=winio@('%taL R B T margins %ta%df%4^rf%df%4^rf%df%4^rf%df%4^rf&', &
          5d-1,LeftMrgn,   RedrawS, 5d-1,RightMrgn, RedrawS, &
          5d-1,BottomMrgn, RedrawS, 5d-1,TopMrgn,   RedrawS)
 i=winio@('   Array size  %`bg[red]%dd%4^rd%ff&', 1, Ncurr, RedrawS)
 i=winio@('%cb&')
 i=RedrawS()
 i=winio@('%ww%pv%pl[x_axis="Time [s]",y_axis=Amplitude,&     
    &title="U (red),    U_A (blue),     I (green) ", &
    & colour=red, colour=blue, colour=green, colour=black, &
    &colour=#CC8800, X_ARRAY, SCALE=LOG_LOG, N_GRAPHS=3]&',&
    & 800, 600, Ncurr, x, y, z, u)
 i=winio@('%ac[esc]%ff&', 'exit')
 i=winio@('%cn%^6bt[E&xit]','exit')
End
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Fri Oct 17, 2014 3:38 pm    Post subject: Reply with quote

I think that the problem is not Simpleplot but %pl.....%pl has been developed to plot a simple plot in a straightforward way....I think we cannot ask too much to %pl.....for the moment...

I have modified my Simpleplot version of your program and found no problem with neither a=1d55 nor adjustable size of arrays Ncurr.....check my code (sorry I couldn't resist to include the classic BUSS logo....)...you will see that it is better to work with Simpleplot and not %pl, although I know that you have good reasons to insist with %pl...

Code:

module funciones
integer xx,yy,resize
integer*4 ans
integer*4 ::b1=1,b2=0
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,ncurr=100
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
real*8 A
if(b1==0)then
  do i=1,5
curve(i)=plot(newLineTrace,newLineWidth,i)
end do
else
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
endif
call qpage(xsize,ysize)
!Print*,xsize,ysize
!call picsiz(xsize,ysize)
CALL PAGMRG(sngl(LeftMrgn),sngl(RightMrgn),sngl(BottomMrgn),sngl(TopMrgn)) ! set PICture MaRGins!
CALL DIAGLV (0) ! suppresses creation of MESSAGES.TXT file
call boxpg2(2)
call linset(1)
call pagvw(iOrientation)
CALL TEXTMN(sngl(TextSize))
CALL AXLBJS('*C','C')
call chset(iCharacterSetNo)
N=ncurr
A=1d5
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
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  setpns(1,1,1,1)!reset the pen colours before redrawing


Last edited by aebolzan on Fri Oct 17, 2014 3:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Fri Oct 17, 2014 3:42 pm    Post subject: Reply with quote

Code:

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)
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
b1=1
b2=0
ncurr=100
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 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@('%2ga&',b1,b2)
ans=winio@('%nl%ta%`rb[]Plot%ta%dd%6^rd&',b1,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,256)
ans=winio@('%taLine color    %dd%6^rd& ',1,newLineColor,bitmap)
ans=winio@('%2nl%ta%^rb[All plots]&',b2,bitmap)
ans=winio@('%ta Array size  %`bg[red]%dd%4^rd%ff&', 1, Ncurr, bitmap)
ans=winio@('%nl%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   


By the way, I would suggest to start a new topic as what we have been discussing during the recent posts are not related anymore with Hershey fonts...maybe something like "Simpleplot and %pl plots"? .....you can decide the name of the new topic...

Agustin
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1554
Location: South Pole, Antarctica

PostPosted: Fri Oct 17, 2014 5:50 pm    Post subject: Reply with quote

Thanks for confirming that my code has no error. That means that my code now directly goes to Paul's Clearwin+ bugs/improvements investigation list.
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Fri Oct 17, 2014 6:15 pm    Post subject: %pl and Simpleplot graphs Reply with quote

I think that maybe the problem is that %pl involves a single call to a Simpleplot plotting subroutine (BRKNCV or MARKCV) and it does it only once, i.e. you can redraw Simpleplot but not the curve(s). With SimpleplotRedraw@ you replot your original data, that was frozen to some extent, and if you have changed some things by calling Simpleplot subroutines (like AXLBLV, Pagvw, TEXTMN, AXLBJS, etc.) they will update those characteristics of the graph, but only those. See that in your code of the call-back function you are not calling subroutines for plotting whereas in my code I replot the data every time by including Subroutine plot_curves in Function bitmap. Try to change not only N, but x or y and I guess you will find the same behaviour....That's why Clearwin offers the possibility of using '%pl[user_drawn] with direct calls to Simpleplot....at least I guess so....

Agustin
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1554
Location: South Pole, Antarctica

PostPosted: Fri Oct 17, 2014 9:50 pm    Post subject: Reply with quote

I suppose how %pl implemented is in total control of Silverfrost. When Simpleplot is doing anything it should look at its key parameters supplied by %pl if they dynamically changed or not. Almost everything in CWP right now works this way and if small portion of controls still not updatable then they definitely have to in the future

I still hope you guys find the hack to push the array size Ncurr down the Simpleplot throat through %pl. As I said I will not touch full Simpleplot with the 100 foot pole until Silverfrost will share full control of its source code OR like many currently existing graphics libraries not supported by its authors until it will be in open domain. That way if needed I will easily rewrite small %pl parts of the code to something else which is supported
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Tue Oct 21, 2014 8:13 pm    Post subject: Reply with quote

... you mean share parts of the FTN95 source code so you can tinker with %pl ? I think that might be some way off Smile
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1554
Location: South Pole, Antarctica

PostPosted: Thu Oct 23, 2014 10:57 am    Post subject: Reply with quote

You know how much time i lost on the bugs of SPlot? Just today 3 hours full voice swearing (was getting exception violations on 10 years old code). And i thought i know all its pitfalls. This POS somehow i still don't understand is sensitive to the data it plots even if it is in the real*4 limits range. How to find the error in this case if source is not available and using debugger is not possible ? If author would at least cleaned the source and got the major bugs out then being eternal betatester of SP would not suck so much
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Mon Oct 27, 2014 3:18 am    Post subject: Reply with quote

*** ***
*** THIS DISCUSSION TRANSFERRED TO NEW POST !!! ***
*** ***
*** DO NOT POST ANYTHING ELSE HERE PLEASE !!!! ***
*** GO TO NEW POST which has been set up, still in the ***
*** SUGGESTIONS Forum which is entitled :- ***
*** '%pl and Simpleplot graphs' ***
*** ... where this topic is continued ***
*** ***
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
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