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 

%pl and Simpleplot graphs
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
aebolzan



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

PostPosted: Thu Oct 23, 2014 2:35 pm    Post subject: %pl and Simpleplot graphs Reply with quote

Dan,

I am moving our discussion about Simpleplot and %pl to a new topic as it seems to me more apropriate, considering the focus of the problems we have being discussing during the last weeks.....thus, taking your last comment from the previous topic:

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


I have to say that I had a different experience....I used Simpleplot with FTN77, FTN90 and FTN95 (both versions, i.e. Salford and Silverfrost) and I do not remember to have had a problem with exception violation....as you know, I practically don't use %pl except as [user_drawn], so that I code always direct calls to Simpleplot subroutines. I wonder if your problems are always with %pl or you found that also calls to Simpleplot gave you exception violations. I think it would be good for the discussion if you could share with us the bugs you found. As you know, I do not consider Simpleplot as a perfect graphical solution for FTN95, but is the only free-one that I found till now. I gave a look at DSLIN and did not find a way to use it with Clearwin, so it was out of discussion for me, and a couple of tests with Simdem did not gave me similar results as Clearwin+Simpleplot: it seemed that Simdem has its proper output, which is nice if you like it, but you cannot configure a Clearwin window as you want. That's the reason I am still with Simpleplot, with all the limitations it still has because is a ...uhmm...10 years old software?.

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



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

PostPosted: Sat Oct 25, 2014 1:22 pm    Post subject: Reply with quote

Here is one more bug: i changed linewidth to 7, which is seen by very thick axis, but plot linewith did not increase. It sometimes changes up by one pixel and then get back
Back to top
View user's profile Send private message
aebolzan



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

PostPosted: Sat Oct 25, 2014 3:03 pm    Post subject: Reply with quote

It looks like you have called thckmg subroutine for the axes and not for the curves....sounds strange...I would like to see your code in order to check what seems to be wrong......

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



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

PostPosted: Sun Oct 26, 2014 3:05 am    Post subject: Reply with quote

The source code is not extractable easily from the larger code. The called stuff before %pl is standard like in all examples above in older thread.
Code:
      CALL DIAGLV (0)
      CALL TEXTMN(sngl(SimplotCircEq_FontSize)) ! 0.35)
      CALL AXLBJS('*C','C')
      call thckmg('LINE',sngl(SimplotCircEq_lineWid)) ! 3
      call chset(iSimplotCircEq_FontCharset) ! -11)

   i=winio@('%pv%pl[x_axis="Time ",y_axis=Amplitude,&     
   &title="U(red, green-anal), U_A on load(orange), I(blue, black-anal)",&
   &colour=red, colour=blue, colour=green, colour=black, colour=#CC8800,X_ARRAY, N_GRAPHS=5]&',&
   &833,300,narr,timearr1,yarr1(1,1),yarr1(1,2),yarr1(1,3),yarr1(1,4),yarr1(1,5))
Back to top
View user's profile Send private message
aebolzan



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

PostPosted: Sun Oct 26, 2014 3:13 pm    Post subject: Reply with quote

please, check this code:
Code:
 Module SomeFun
 INCLUDE <windows.ins>
 real*8 :: TextSize=0.41
 integer:: LineWidth=1, iCharacterSetNo=-11, N=100,A=25
 Real*8  x(100), y(100), z(100), u(100), v(100), w(100)
 CONTAINS
 integer function RedrawS ()
 CALL DIAGLV (0)
 CALL TEXTMN(sngl(TextSize)) ! 45)
 CALL AXLBJS('*C','C')
 call thckmg('LINE', float(LineWidth))
 call chset(iCharacterSetNo)
 call simpleplot_redraw@
 RedrawS = 1
 End function
  End Module SomeFun
 Program Simple2
 use SomeFun
 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@('%sy[3d_raised]&')
 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@('%ta Charset  (-12 to +26)%ta%dd%6^rd&', &
          1, iCharacterSetNo, RedrawS)
 i=winio@('%cb&')
 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, N_GRAPHS=5]&',&
    & 833, 300, N, x, y, z, u, v, w)
 i=winio@('%ac[esc]%ff&', 'exit')
 i=winio@('%cn%^6bt[E&xit]','exit')
End Program


it tries to do what you say and in my case, I get that all the lines have the same thickness. In fact, when you use %pl instead of Simpleplot subroutines, you are not in control of the different lines: you just set the thickness of any line before entering in %pl, so that all lines, axes and curves should have the same properties.. I do not see with your partial code why you are getting different results. If the code above works for you, seems that the problem is not with Simpleplot.....

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



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

PostPosted: Mon Oct 27, 2014 12:37 am    Post subject: Reply with quote

What was the trick in this code above? Quick look at this code tells that it is the same as in the other thread which I know that it works fine. But the one I report as buggy is essentially the same code, it has just more irrelevant stuff in modules to post here. Yet it glitches. Something interferes with not so robust and not polished by many users %pl. I actually suspect I was so far the only one "betatester" who used it from its start in 90-th Smile . Well, will try to extract the %pl code from larger one when have time and see what that gives.
Back to top
View user's profile Send private message
aebolzan



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

PostPosted: Mon Oct 27, 2014 12:55 am    Post subject: Reply with quote

there is no trick at all... Smile ...it's a short version of the previous ones as you noted.....I put it to show you that it was quite strange what you found with your code.....I use %pl as well, but only when the plots are quite simple and I do not require a lot of customisation......so you are not alone with %pl!....what I suspect is that you are using several %pl statements and likely before one of them you are setting the thickness of the lines and in the other one not.....but as you know, without the more or less complete code I cannot check that.....I know that you like a single command for plotting, but my advise is to use %pl, if you like it, as user_drawn and allow the customisation of the graphs by using direct calls to Simpleplot subroutines....

so, in the end, I do not find that it was a bug in Simpleplot, but something else in some part of your code.....

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



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Oct 27, 2014 2:59 am    Post subject: Reply with quote

Hiya SimplePlot Companeros ! Smile

I see a couple of things:
1) Dan , you use 400 timesteps (N) in your plot, Agustin you use the 'original' 100.
Could this be related to why Agustin's code doesn't have a problem ?
You could each try each others 't' span and see if there's a difference.

2) could the problem be related to the 'curvature' of the plots and Simpleplot , once again, being too clever for it's own good and limiting the line thickness so as to get a 'readable' curve (imagine dan's plot with a line thickness of 7, the 'peaks' would be impossible to determine correctly I think.
Dan try your code with a very simple curve say a STRAIGHT SINE, 0-90, and see what happens with a line thickness of 7.

Which raises another 'lim9tation of %pl - what is the 'default' style of curve drawing (which SimplePlot command does it use to draeìw the curves ?) and is it possible to change it by some clever means ?
I would guess not, for the same reason as Agustin points out.
I remember once asking the question somewhere on one of the forums 'Is %pl just effectively a series of calls to Simpleplot routines' and the answer was of course 'yes'. In fact I think the %pl is just actually just a subroutine of direct calls to Simpleplot 'a la Agustin method' if you like, which obviously has some limitations as Agustin said. Some things will be modifiable , notably the 'parameters' set before %pl is called, and others like curve style, labels, etc.... which actually appear within the %pl parameter list will not be modifiable. Unless we can find a clever trick Smile.

As an aside, I also blinked when I saw the tick marks on Dan's plot, which appear to be 'sharpened' for X-axis and minor ticks on Y axis, now how did that darn well happen !? The major ticks on Y appear just to be straight lines. Another 'too clever for it's own good trick of SimplePlot or a bug ?

John

Simpleplot ... err ... Rules ! Long live Simple-err-plot !?
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

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

... forgot to add ...
Dan you said : "It sometimes changes up by one pixel and then get back "

Could this point to something related to when simpleplot 'scales' the graphic to fit into a particular window sixe (remember its (some would say not-so-)clever auto-scaling to maximise window utilisation or to fit everything in there) ?

Maybe the line width is set to 2 pixels because of the curvature effect I described above and then is reduced after scaling if the font size is increased ?

What do you mean 'sometimes' ? What's different 'sometimes' ?
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Oct 27, 2014 8:13 am    Post subject: Reply with quote

John, You could be right. Some bug adjusts linewidth wrong way

I extracted the buggy code, it is still pretty large, i am trying to shorten it, will post it soon if this is not my own error


Last edited by DanRRight on Mon Oct 27, 2014 8:30 am; edited 1 time in total
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Oct 27, 2014 8:21 am    Post subject: Reply with quote

start by running with only 100 timesteps as I suggested above, making your problem closer t othe one in Agustin's working code
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Oct 27, 2014 8:37 am    Post subject: Reply with quote

Well, the reason seems is different. Here is this @#$%^ bug in all its glory. I reproduced it on our regular test code.
It happens when Y value becomes negative. I changed only Y(i) function to allow it to be negative. When Y is always positive the linewidth is 7. When Y gets both positive and negative it switches to 1.


Code:

Module SomeFun
  INCLUDE <windows.ins>
  real*8 :: TextSize=0.41
  integer:: LineWidth=7, iCharacterSetNo=-11, N=100,A=25
  Real*8  x(100), y(100), z(100), u(100), v(100), w(100)
  CONTAINS
  integer function RedrawS ()
  CALL DIAGLV (0)
  CALL TEXTMN(sngl(TextSize)) ! 45)
  CALL AXLBJS('*C','C')
  call thckmg('LINE', float(LineWidth))
  call chset(iCharacterSetNo)
  call simpleplot_redraw@
  RedrawS = 1
  End function
   End Module SomeFun
  Program Simple2
  use SomeFun
  do i=1,N;
  x(i)=i-1
  y(i)=A*sin(i/30.);
  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@('%sy[3d_raised]&')
  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@('%ta Charset  (-12 to +26)%ta%dd%6^rd&', &
           1, iCharacterSetNo, RedrawS)
  i=winio@('%cb&')
  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, N_GRAPHS=5]&',&
     & 833, 300, 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
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Oct 27, 2014 1:23 pm    Post subject: Reply with quote

I did a bit of playing around and changed Agustin's code to 'go negative' and it exhibits the same behaviour as you see Dan.
I then went back to Agustin's code (using the raw calls to SimplePlot Routines for your previous 'problem' (the one that started the development and use of the multi-button I/F to change the parameters)), changed it to go negative and ... Presto ! IT WORKS FINE ! (I went to t=10)

Conclusion:- it's a %pl implementation problem or as you say something queer with trying to 'over-ride' the line thickness with our call to THCKMG (but that's the least likely I think as we've successfully used it previously (and it works when all is positive !!!)

We probably need to know more about HOW %PL works exactly, like:
which module does it call to plot the curves ?
how exactly is default line thickness set ?
how could going negative 'freeze' the line thickness at 1 ?
etc ....

PAUL !! ??? over to you Smile
Back to top
View user's profile Send private message
aebolzan



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

PostPosted: Mon Oct 27, 2014 1:55 pm    Post subject: Reply with quote

as far as I remember (I do not have my computer with me at this moment) the "default" value for lines thickness in Simpleplot is 1, so that it seems that %pl does not like negative data in the curves so much and resets the value of the curves line to 1. Why?....well seems that we can only say that Simpleplot is "not guilty" as, as John said, it apparently comes from some kind of bug in %pl, and that's a problem for Silverfrost not for "BUSS".
John: have you tested the problem with direct calls to Simpleplot using the spwin module or the %pl[user_drawn] way?......I wonder if it also happens with %pl as a user drawn window.....

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



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Oct 28, 2014 4:49 am    Post subject: Reply with quote

"I did a bit of playing around and changed Agustin's code to 'go negative' and it exhibits the same behaviour as you see Dan."

- that was your last example i.e. the %pl way

"I then went back to Agustin's code (using the raw calls to SimplePlot Routines for your previous 'problem' (the one that started the development and use of the multi-button I/F to change the parameters)), changed it to go negative and ... Presto ! IT WORKS FINE ! (I went to t=10) "

- that was the direct calls way i.e. direct calls seems to work no problem
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 1, 2  Next
Page 1 of 2

 
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