Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Re: plot using EXCEL

Expand Messages
  • RipSaw
    Here is the code.  I want to plot inside Excel.   I used to do it on the old Gateway of 1997.  This really did plot with MS Works and Excel.   
    Message 1 of 22 , Apr 1, 2010
    • 0 Attachment
      Here is the code.  I want to plot inside Excel.   I used to do it on the old Gateway of 1997.  This really did plot with MS Works and Excel.
         ebat=100                     :print using(" ##############",ebat);:print " Volts"
          r = 3000000               :print using(" ##############",r)      ;:print " Ohms"
          c=.000000000010   :print using(" #.############",c)        ;:print " Farads"
          rc= r*c :  Print "Resistence and Capacitance=   "; rc
          hl=(r*c)*0.693147180559945309417232121458177
          print " Half Life = "  ;:print using(" #.#########",hl);:print " Seconds"
         tc        =r*c       :print using(" #.######",tc)       ;:print "   ,   "  ;:print " 1 Time Constant"
         two    =2*tc     :print using(" #.######",two)    ;:print "   ,   "  ;:print " 2 Time Constants"
         three =3*tc     :print using(" #.######",three) ;:print "   ,   "  ;:print " 3 Time Constants"
         four   =4*tc     :print using(" #.######",four)   ;:print "   ,   "  ;:print " 4 Time Constants"
         etc     =5*tc      :print using(" #.######",etc)     ;:print "   ,   "  ;:print " 5 Time Constants"
         for tm= 0 to  etc step  etc/48
           ec=ebat*(1-exp(0-tm/(r*c)))
           er = ebat-ec
           print using(" ###.###### ",tm);:print "   ,   " ;:print using(" ####.## ",ec);:print "   ,   " ;:print using(" ####.## ",er)
         next tm
      STOP
         for tm= two to etc step  etc/10
          ec=ebat*(1-exp(0-tm/(r*c)))
          er = ebat-ec
          print using(" ###.###### ",tm);:print "   ,   " ;:print using(" ####.## ",ec);:print "   ,   " ;:print using(" ####.## ",er)
         next tm


      ________________________________
      From: paradisejb <jburman1860@...>
      To: libertybasic@yahoogroups.com
      Sent: Thu, April 1, 2010 2:34:16 AM
      Subject: [libertybasic] Re: plot using EXCEL

       
      Wouldn't this just be a matter of saving your LB data as a .CSV (comma separated value) file and importing it into Excel?
      Just wondering...

      --- In libertybasic@ yahoogroups. com, RipSaw <rij4360@... > wrote:
      >
      > I want to plot using Excel. How can I take LB code and plot it?
      > I used to do it on my old Gateway 1997.
      >
      > I have plotting inside Excel.
      > Kurt
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >







      [Non-text portions of this message have been removed]
    • RipSaw
      IT WORKED!   Whoever you are THANK U. Save data to a text file.  Saved as CSV - Followed directions. IT WORKED!!!!! Kurt USA PA Now I want a larger chart.
      Message 2 of 22 , Apr 1, 2010
      • 0 Attachment
        IT WORKED!   Whoever you are THANK U.
        Save data to a text file.  Saved as CSV - Followed directions.
        IT WORKED!!!!!
        Kurt USA PA
        Now I want a larger chart. Im using Excel.   A big chart, say 8 x 10.   Fit a page.
        Not a small graph that Excel did.
        Thank you again 1000 times




        ________________________________
        From: paradisejb <jburman1860@...>
        To: libertybasic@yahoogroups.com
        Sent: Thu, April 1, 2010 2:34:16 AM
        Subject: [libertybasic] Re: plot using EXCEL

         
        Wouldn't this just be a matter of saving your LB data as a .CSV (comma separated value) file and importing it into Excel?
        Just wondering...

        --- In libertybasic@ yahoogroups. com, RipSaw <rij4360@... > wrote:
        >
        > I want to plot using Excel. How can I take LB code and plot it?
        > I used to do it on my old Gateway 1997.
        >
        > I have plotting inside Excel.
        > Kurt
        >
        >
        >
        >
        > [Non-text portions of this message have been removed]
        >







        [Non-text portions of this message have been removed]
      • John Fisher
        Glad it worked for you. Bigger printout? Copy your Excel graph. Paste it onto a Word page of the size you want. Drag it to fill the page. Add any extra text
        Message 3 of 22 , Apr 1, 2010
        • 0 Attachment
          Glad it worked for you.
          Bigger printout? Copy your Excel graph. Paste it onto a Word page of the
          size you want. Drag it to fill the page. Add any extra text etc. Print!

          You could of course just plot it within LB and print from there....
        • RipSaw
          UP ALL night!! playing w it! it does work. Ran the run. Then the Charge Discharge values I   c/p  into a notepad file ChargeDis.CSV    -  Follow
          Message 4 of 22 , Apr 1, 2010
          • 0 Attachment
            UP ALL night!! playing w it! it does work.
            Ran the run. Then the Charge Discharge values I   c/p  into a notepad file "ChargeDis.CSV"   -  Follow Directions.

            How do u print inside LB?  must I write print routines?
            Where r u?  Here USA PA
            thank u VERY much




            ________________________________
            From: John Fisher <mr.john.f@...>
            To: libertybasic@yahoogroups.com
            Sent: Thu, April 1, 2010 4:40:54 AM
            Subject: Re: [libertybasic] Re: plot using EXCEL

             
            Glad it worked for you.
            Bigger printout? Copy your Excel graph. Paste it onto a Word page of the
            size you want. Drag it to fill the page. Add any extra text etc. Print!

            You could of course just plot it within LB and print from there....






            [Non-text portions of this message have been removed]
          • John Fisher
            I m in the UK.... Try the following to get an idea of working from LB without MS intermediate stages... I just scale the results to fit from 10 to 490 in a
            Message 5 of 22 , Apr 1, 2010
            • 0 Attachment
              I'm in the UK....
              Try the following to get an idea of working from LB without MS
              intermediate stages... I just scale the results to fit from 10 to 490 in
              a 500x5000 graphic area. You may want to change vga to xvga or svga to
              match your setup.
              LB plotting is REALLY easy.


              nomainwin

              ebat = 1e2
              r = 3.0e6
              c = 10e-12

              WindowWidth = 530
              WindowHeight = 560

              graphicbox #w.g, 10, 10, 500, 500

              open "Charging Capacitor" for window as #w

              #w, "trapclose [quit]"
              #w.g, "size 2 ; goto 10 10 ; down ; box 490 490"
              #w.g, "place 200 200 ; font arial 18 bold"
              #w.g, "\Discharging CR circuit"


              for t =0 to 5 *r *c step r *c /50
              ec =ebat *( 1 -exp( 0 -t / ( r *c)))
              er = ebat -ec
              #w.g, "color red ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
              490 -int( er /ebat *480)
              #w.g, "color blue ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
              490 -int( ec /ebat *480)
              next t

              #w.g, "flush"

              confirm "Send to printer?"; answer
              if answer then #w.g, "print svga"

              wait

              [quit]
              close #w
              end
            • John Fisher
              Or with axes added.... nomainwin ebat = 1e2 r = 3.0e6 c = 10e-12 WindowWidth = 530 WindowHeight = 560 graphicbox #w.g, 10, 10, 500, 500 open Charging
              Message 6 of 22 , Apr 1, 2010
              • 0 Attachment
                Or with axes added....


                nomainwin

                ebat = 1e2
                r = 3.0e6
                c = 10e-12

                WindowWidth = 530
                WindowHeight = 560

                graphicbox #w.g, 10, 10, 500, 500

                open "Charging Capacitor" for window as #w

                #w, "trapclose [quit]"

                #w.g, "size 2 ; goto 10 10 ; down ; box 490 490"

                #w.g, "place 190 200 ; font arial 18 bold"
                #w.g, "\Discharging CR circuit"

                #w.g, "size 1 ; color lightgray"

                for vAxis =1 to 5
                #w.g, "line "; 10 +int( vAxis /5 *480); " 10 "; 10 +int( vAxis
                /5 *480); " 490"
                next vAxis

                for hAxis =1 to 10
                #w.g, "line 10 "; 10 +int( hAxis /10 *480); " 490 "; 10 +int(
                hAxis /10 *480)
                next hAxis

                #w.g, "size 2"

                for t =0 to 5 *r *c step r *c /50
                ec =ebat *( 1 -exp( 0 -t / ( r *c)))
                er = ebat -ec
                #w.g, "color red ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
                490 -int( er /ebat *480)
                #w.g, "color blue ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
                490 -int( ec /ebat *480)
                next t

                #w.g, "flush"

                confirm "Send to printer?"; answer
                if answer then #w.g, "print vga"

                wait

                [quit]
                close #w
                end
              • RipSaw
                               for x= -10 to 20                 y= 1/2 *x + 1                 print using( ####.# ,x) ;:print
                Message 7 of 22 , Apr 1, 2010
                • 0 Attachment
                                 for x= -10 to 20
                                  y= 1/2 *x + 1
                                  print using(" ####.#",x) ;:print "   ,   "  ;:print using(" ####.#",y)
                                  next x

                  John the above code you will relize is a simple line.  I just plotted this line in Excel (now that I know what I am doing)
                  in abt 30 secs.  Would u be kind enuff to write code, and use rem statements to tell me (the novice) what u are doing?
                  I tried to plot abt 1 yr ago and then I ran out of steam.

                  I want a nice big page, please think this line might be for a large presentation.   Not a small graph.    I have 8 x 11 paper here.
                  Kurt





                  ________________________________
                  From: John Fisher <mr.john.f@...>
                  To: libertybasic@yahoogroups.com
                  Sent: Thu, April 1, 2010 9:59:09 AM
                  Subject: Re: [libertybasic] Re: plot using EXCEL

                   
                  Or with axes added....

                  nomainwin

                  ebat = 1e2
                  r = 3.0e6
                  c = 10e-12

                  WindowWidth = 530
                  WindowHeight = 560

                  graphicbox #w.g, 10, 10, 500, 500

                  open "Charging Capacitor" for window as #w

                  #w, "trapclose [quit]"

                  #w.g, "size 2 ; goto 10 10 ; down ; box 490 490"

                  #w.g, "place 190 200 ; font arial 18 bold"
                  #w.g, "\Discharging CR circuit"

                  #w.g, "size 1 ; color lightgray"

                  for vAxis =1 to 5
                  #w.g, "line "; 10 +int( vAxis /5 *480); " 10 "; 10 +int( vAxis
                  /5 *480); " 490"
                  next vAxis

                  for hAxis =1 to 10
                  #w.g, "line 10 "; 10 +int( hAxis /10 *480); " 490 "; 10 +int(
                  hAxis /10 *480)
                  next hAxis

                  #w.g, "size 2"

                  for t =0 to 5 *r *c step r *c /50
                  ec =ebat *( 1 -exp( 0 -t / ( r *c)))
                  er = ebat -ec
                  #w.g, "color red ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
                  490 -int( er /ebat *480)
                  #w.g, "color blue ; set "; 10 +int( t / ( 5 * r *c) *480); " ";
                  490 -int( ec /ebat *480)
                  next t

                  #w.g, "flush"

                  confirm "Send to printer?"; answer
                  if answer then #w.g, "print vga"

                  wait

                  [quit]
                  close #w
                  end







                  [Non-text portions of this message have been removed]
                • John Fisher
                  Hope the following makes sense- I d next want to add numbers and minor grid lines! Just copy & paste into LB/JB. Try altering bits you understand a tiny bit at
                  Message 8 of 22 , Apr 1, 2010
                  • 0 Attachment
                    Hope the following makes sense- I'd next want to add numbers and minor
                    grid lines!
                    Just copy & paste into LB/JB.
                    Try altering bits you understand a tiny bit at a time, and check what
                    happens.
                    Reverse anything that fails to do what you want!
                    We all started simple, and learned from others' code.
                    The Help files are your first source- for eg. the names of available
                    colours.

                    JohnF


                    ' We don't need the text-only 'mainwin' but it may help debugging
                    ' by allowing us to see values.
                    nomainwin
                    ' But we DO need a graphicbox area in a 'Window'
                    ' Choose size of this window (allow for scrollbars)
                    WindowWidth = 530
                    WindowHeight = 580
                    ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                    graphicbox #w.g, 10, 10, 500, 500

                    ' Open the window showing this empty graphicbox
                    open "Simple Graph" for window as #w
                    ' Make sure clicking 'close' icon at top RH exits cleanly.
                    #w, "trapclose [quit]"
                    ' Tell LB to put printing 'pen' down on page.
                    #w.g, "down"
                    ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                    #w.g, "size 2"

                    ' Work out how far apart lowest & highest x and y values are
                    xMin =-10
                    xMax = 20
                    yMin = ( 1 /2 * -10 +1)
                    yMax = ( 1 /2 * 20 +1)
                    yRange = yMax -yMin
                    xRange = xMax -xMin

                    print xRange; " "; yRange

                    ' step through the x range with small steps ( try bigger/smaller
                    steps)
                    for x= -10 to 20 step 0.1
                    ' Work out the function's value at eac x position.
                    y = 1 /2 *x +1
                    ' Now you need to change so x_min plots at 0 and x_max at 500
                    xScreen = int( ( x -xMin) /xRange *500)
                    ' and same for y. BUT y in LB/MS counts down from top...
                    ' so we subtract it from 500 so it counts up from bottom.
                    yScreen =500 -int( ( y -yMin) /yRange *500)
                    ' Send a 'set x y' command- it plots a dot at ( x_screen,
                    y_screen)
                    #w.g, "set "; xScreen; " "; yScreen
                    next x

                    ' This is hard to interpret, without axes drawn. We need range (
                    -10, -5) to
                    ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                    ' but as before we scale, and invert y direction.
                    ' First, horiz. axis thru. origin.
                    ' Choose thicker line in colour red.
                    #w.g, "size 4 ; color red"
                    #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                    #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                    ' Now the vertical axis
                    #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                    #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                    ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                    ' This makes the graphics 'stick'. Otherwise if covered and then
                    ' uncovered they are eerased and not re-drawn.
                    #w.g, "flush"

                    ' Hang around for 10 seconds ( 10000 ms)
                    timer 10000, [on]
                    wait
                    [on]
                    timer 0

                    ' Put up a message for you to confirm (or not) printout.
                    confirm "Send to printer?"; answer
                    ' If wanted, do a printout..
                    if answer then #w.g, "print vga"

                    ' Wait, with graphic on-screen.wait

                    ' Come to here only if 'close' icon clicked.
                    [quit]
                    ' Shut the window
                    close #w
                    ' Tell LB the program has ended!
                    end
                  • RipSaw
                    Bloody MARVELOUS!     I am running now! and studying.  ________________________________ From: John Fisher To:
                    Message 9 of 22 , Apr 1, 2010
                    • 0 Attachment
                      Bloody MARVELOUS!     I am running now! and studying. 




                      ________________________________
                      From: John Fisher <mr.john.f@...>
                      To: libertybasic@yahoogroups.com
                      Sent: Thu, April 1, 2010 7:05:12 PM
                      Subject: Re: [libertybasic] Re: plot using EXCEL

                       
                      Hope the following makes sense- I'd next want to add numbers and minor
                      grid lines!
                      Just copy & paste into LB/JB.
                      Try altering bits you understand a tiny bit at a time, and check what
                      happens.
                      Reverse anything that fails to do what you want!
                      We all started simple, and learned from others' code.
                      The Help files are your first source- for eg. the names of available
                      colours.

                      JohnF

                      ' We don't need the text-only 'mainwin' but it may help debugging
                      ' by allowing us to see values.
                      nomainwin
                      ' But we DO need a graphicbox area in a 'Window'
                      ' Choose size of this window (allow for scrollbars)
                      WindowWidth = 530
                      WindowHeight = 580
                      ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                      graphicbox #w.g, 10, 10, 500, 500

                      ' Open the window showing this empty graphicbox
                      open "Simple Graph" for window as #w
                      ' Make sure clicking 'close' icon at top RH exits cleanly.
                      #w, "trapclose [quit]"
                      ' Tell LB to put printing 'pen' down on page.
                      #w.g, "down"
                      ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                      #w.g, "size 2"

                      ' Work out how far apart lowest & highest x and y values are
                      xMin =-10
                      xMax = 20
                      yMin = ( 1 /2 * -10 +1)
                      yMax = ( 1 /2 * 20 +1)
                      yRange = yMax -yMin
                      xRange = xMax -xMin

                      print xRange; " "; yRange

                      ' step through the x range with small steps ( try bigger/smaller
                      steps)
                      for x= -10 to 20 step 0.1
                      ' Work out the function's value at eac x position.
                      y = 1 /2 *x +1
                      ' Now you need to change so x_min plots at 0 and x_max at 500
                      xScreen = int( ( x -xMin) /xRange *500)
                      ' and same for y. BUT y in LB/MS counts down from top...
                      ' so we subtract it from 500 so it counts up from bottom.
                      yScreen =500 -int( ( y -yMin) /yRange *500)
                      ' Send a 'set x y' command- it plots a dot at ( x_screen,
                      y_screen)
                      #w.g, "set "; xScreen; " "; yScreen
                      next x

                      ' This is hard to interpret, without axes drawn. We need range (
                      -10, -5) to
                      ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                      ' but as before we scale, and invert y direction.
                      ' First, horiz. axis thru. origin.
                      ' Choose thicker line in colour red.
                      #w.g, "size 4 ; color red"
                      #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                      #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                      ' Now the vertical axis
                      #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                      #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                      ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                      ' This makes the graphics 'stick'. Otherwise if covered and then
                      ' uncovered they are eerased and not re-drawn.
                      #w.g, "flush"

                      ' Hang around for 10 seconds ( 10000 ms)
                      timer 10000, [on]
                      wait
                      [on]
                      timer 0

                      ' Put up a message for you to confirm (or not) printout.
                      confirm "Send to printer?"; answer
                      ' If wanted, do a printout..
                      if answer then #w.g, "print vga"

                      ' Wait, with graphic on-screen.wait

                      ' Come to here only if 'close' icon clicked.
                      [quit]
                      ' Shut the window
                      close #w
                      ' Tell LB the program has ended!
                      end







                      [Non-text portions of this message have been removed]
                    • RipSaw
                      look below,   I wish u were here.   This is like Greek. In England do you use any cool swear words that you can teach me? I cant slander the lord s name at
                      Message 10 of 22 , Apr 1, 2010
                      • 0 Attachment
                        look below,   I wish u were here.   This is like Greek.
                        In England do you use any cool swear words that you can teach me?
                        I cant slander the lord's name at easter.


                        ________________________________
                        From: John Fisher <mr.john.f@...>
                        To: libertybasic@yahoogroups.com
                        Sent: Thu, April 1, 2010 7:05:12 PM
                        Subject: Re: [libertybasic] Re: plot using EXCEL

                         
                        Hope the following makes sense- I'd next want to add numbers and minor
                        grid lines!
                        Just copy & paste into LB/JB.
                        Try altering bits you understand a tiny bit at a time, and check what
                        happens.
                        Reverse anything that fails to do what you want!
                        We all started simple, and learned from others' code.
                        The Help files are your first source- for eg. the names of available
                        colours.

                        JohnF

                        ' We don't need the text-only 'mainwin' but it may help debugging
                        ' by allowing us to see values.
                        nomainwin
                        ' But we DO need a graphicbox area in a 'Window'
                        ' Choose size of this window (allow for scrollbars)
                        WindowWidth = 530
                        WindowHeight = 580
                        ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                        WHAT IS #w.g,??  10, 10, is that thickness of border
                        graphicbox #w.g, 10, 10, 500, 500 

                        ' Open the window showing this empty graphicbox
                        open "Simple Graph" for window as #w
                        ' Make sure clicking 'close' icon at top RH exits cleanly.
                        #w, "trapclose [quit]"
                        ' Tell LB to put printing 'pen' down on page.
                        #w.g, "down"
                        ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                        #w.g, "size 2"

                        ' Work out how far apart lowest & highest x and y values are
                        xMin =-10
                        xMax = 20
                        yMin = ( 1 /2 * -10 +1)
                        yMax = ( 1 /2 * 20 +1)
                        yRange = yMax -yMin
                        xRange = xMax -xMin

                        print xRange; " "; yRange

                        ' step through the x range with small steps ( try bigger/smaller
                        steps)
                        for x= -10 to 20 step 0.1
                        ' Work out the function's value at eac x position.
                        y = 1 /2 *x +1
                        ' Now you need to change so x_min plots at 0 and x_max at 500
                        WHY NEED TO CHANGE ABOVE PLOTS?
                        xScreen = int( ( x -xMin) /xRange *500)
                        ' and same for y. BUT y in LB/MS counts down from top...
                        ' so we subtract it from 500 so it counts up from bottom.
                        yScreen =500 -int( ( y -yMin) /yRange *500)
                        ' Send a 'set x y' command- it plots a dot at ( x_screen,
                        y_screen)
                        #w.g, "set "; xScreen; " "; yScreen
                        next x

                        ' This is hard to interpret, without axes drawn. We need range (
                        -10, -5) to
                        ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                        ' but as before we scale, and invert y direction.
                        ' First, horiz. axis thru. origin.
                        ' Choose thicker line in colour red.
                        #w.g, "size 4 ; color red"
                        #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                        #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                        ' Now the vertical axis
                        #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                        #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                        ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                        ' This makes the graphics 'stick'. Otherwise if covered and then
                        ' uncovered they are eerased and not re-drawn.
                        #w.g, "flush"

                        ' Hang around for 10 seconds ( 10000 ms)
                        timer 10000, [on]
                        wait
                        [on]
                        timer 0

                        ' Put up a message for you to confirm (or not) printout.
                        confirm "Send to printer?"; answer
                        ' If wanted, do a printout..
                        if answer then #w.g, "print vga"

                        ' Wait, with graphic on-screen.wait

                        ' Come to here only if 'close' icon clicked.
                        [quit]
                        ' Shut the window
                        close #w
                        ' Tell LB the program has ended!
                        end







                        [Non-text portions of this message have been removed]
                      • RipSaw
                        Look Below John Color We don t need the text-only mainwin but it may help debugging by allowing us to see values. nomainwin But we DO need a graphicbox
                        Message 11 of 22 , Apr 1, 2010
                        • 0 Attachment
                          Look Below John Color
                          ' We don't need the text-only 'mainwin' but it may help debugging
                          ' by allowing us to see values.
                          nomainwin
                          ' But we DO need a graphicbox area in a 'Window'
                          ' Choose size of this window (allow for scrollbars)
                          WindowWidth = 530
                          WindowHeight = 580
                          ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                          graphicbox #w.g, 10, 10, 500, 500
                          ' Open the window showing this empty graphicbox
                          open "Kurt Simple Graph" for window as #w
                          ' Make sure clicking 'close' icon at top RH exits cleanly.
                          #w, "trapclose [quit]"
                          ' Tell LB to put printing 'pen' down on page.
                          #w.g, "down"
                          ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                          #w.g, "size 2"
                          ' Work out how far apart lowest & highest x and y values are
                          xMin =-10
                          xMax = 20
                          yMin = ( 1 /2 * -10 +1)
                          yMax = ( 1 /2 * 20 +1)
                          yRange = yMax -yMin
                          xRange = xMax -xMin
                          print xRange; " "; yRange
                          ' step through the x range with small steps ( try bigger/smaller steps)
                          for x= -10 to 20 step .1
                          ' Work out the function's value at eac x position.
                          y = 1 /2 *x +1
                          ' Now you need to change so x_min plots at 0 and x_max at 500
                          xScreen = int( ( x -xMin) /xRange *500)
                          ' and same for y. BUT y in LB/MS counts down from top...
                          ' so we subtract it from 500 so it counts up from bottom.
                          yScreen =500 -int( ( y -yMin) /yRange *500)
                          ' Send a 'set x y' command- it plots a dot at ( x_screen, y_screen)
                          #w.g, "set "; xScreen; " "; yScreen
                          next x
                          ' This is hard to interpret, without axes drawn. We need range ( -10, -5) to
                          ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                          ' but as before we scale, and invert y direction.
                          ' First, horiz. axis thru. origin.
                          ' Choose thicker line in colour red.
                          #w.g, "size 4 ; color red"
                          #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                          #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                          ' Now the vertical axis
                          #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                          #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                          ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)
                          ' This makes the graphics 'stick'. Otherwise if covered and then
                          ' uncovered they are eerased and not re-drawn.
                          #w.g, "flush"
                          ' Hang around for 10 seconds ( 10000 ms)
                          timer 10000, [on]
                          wait
                          [on]
                          timer 0
                          ' Put up a message for you to confirm (or not) printout.
                          confirm "Send to printer?"; answer
                          ' If wanted, do a printout..
                          if answer then #w.g, "print vga"
                          ' Wait, with graphic on-screen.wait
                          ' Come to here only if 'close' icon clicked.
                          [quit]
                          ' Shut the window
                          close #w
                          ' Tell LB the program has ended!
                          end





                          ________________________________
                          From: John Fisher <mr.john.f@...>
                          To: libertybasic@yahoogroups.com
                          Sent: Thu, April 1, 2010 7:05:12 PM
                          Subject: Re: [libertybasic] Re: plot using EXCEL

                           
                          Hope the following makes sense- I'd next want to add numbers and minor
                          grid lines!
                          Just copy & paste into LB/JB.
                          Try altering bits you understand a tiny bit at a time, and check what
                          happens.
                          Reverse anything that fails to do what you want!
                          We all started simple, and learned from others' code.
                          The Help files are your first source- for eg. the names of available
                          colours.

                          JohnF

                          ' We don't need the text-only 'mainwin' but it may help debugging
                          ' by allowing us to see values.
                          nomainwin
                          ' But we DO need a graphicbox area in a 'Window'
                          ' Choose size of this window (allow for scrollbars)
                          WindowWidth = 530
                          WindowHeight = 580
                          ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                          graphicbox #w.g, 10, 10, 500, 500

                          ' Open the window showing this empty graphicbox
                          open "Simple Graph" for window as #w
                          ' Make sure clicking 'close' icon at top RH exits cleanly.
                          #w, "trapclose [quit]"
                          ' Tell LB to put printing 'pen' down on page.
                          #w.g, "down"
                          ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                          #w.g, "size 2"

                          ' Work out how far apart lowest & highest x and y values are
                          xMin =-10
                          xMax = 20
                          yMin = ( 1 /2 * -10 +1)
                          yMax = ( 1 /2 * 20 +1)
                          yRange = yMax -yMin
                          xRange = xMax -xMin

                          This print should that print to t he screen?
                          print #  <<<< prints to a file - what does this do?
                          print xRange; " "; yRange

                          ' step through the x range with small steps ( try bigger/smaller
                          steps)
                          for x= -10 to 20 step 0.1
                          ' Work out the function's value at eac x position.
                          y = 1 /2 *x +1
                          ' Now you need to change so x_min plots at 0 and x_max at 500
                          xScreen = int( ( x -xMin) /xRange *500)
                          ' and same for y. BUT y in LB/MS counts down from top...
                          ' so we subtract it from 500 so it counts up from bottom.
                          yScreen =500 -int( ( y -yMin) /yRange *500)
                          ' Send a 'set x y' command- it plots a dot at ( x_screen,
                          y_screen)
                          IS #w.g a file?
                          #w.g, "set "; xScreen; " "; yScreen
                          next x

                          ' This is hard to interpret, without axes drawn. We need range (
                          -10, -5) to
                          ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                          ' but as before we scale, and invert y direction.
                          ' First, horiz. axis thru. origin.
                          ' Choose thicker line in colour red.
                          #w.g, "size 4 ; color red"
                          #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                          #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                          ' Now the vertical axis
                          #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                          #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                          ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                          ' This makes the graphics 'stick'. Otherwise if covered and then
                          ' uncovered they are eerased and not re-drawn.
                          #w.g, "flush"

                          ' Hang around for 10 seconds ( 10000 ms)
                          timer 10000, [on]
                          wait
                          [on]
                          timer 0

                          ' Put up a message for you to confirm (or not) printout.
                          confirm "Send to printer?"; answer
                          ' If wanted, do a printout..
                          if answer then #w.g, "print vga"

                          ' Wait, with graphic on-screen.wait

                          ' Come to here only if 'close' icon clicked.
                          [quit]
                          ' Shut the window
                          close #w
                          ' Tell LB the program has ended!
                          end







                          [Non-text portions of this message have been removed]
                        • John Fisher
                          Abouy the simplest I can go is the following. Are you looking at the Help files? Have you tried the supplied lessons? Do you know how to single step through
                          Message 12 of 22 , Apr 2, 2010
                          • 0 Attachment
                            Abouy the simplest I can go is the following. Are you looking at the
                            Help files? Have you tried the supplied lessons?
                            Do you know how to 'single step' through a program with the 'bug' icon
                            next to the 'run' arrow icon?
                            If so, try the following and try modifying it.
                            Don't expect to do everything immediately!


                            ' We don't need the text-only 'mainwin' but it may help debugging
                            ' by allowing us to see values.
                            nomainwin

                            ' But we DO need a graphicbox #w.g in a 'Window' called #w.
                            ' Choose size and position on your screen of this window (allow for
                            scrollbars)
                            ' Measurements all are referred to the top left.
                            ' For the big window #w, it will be started 10 below & 10 to right of
                            screen top-left.
                            ' Its size will be 530 wide by 560 vertically, but this includes
                            scrill bar/title/border.
                            ' 10 dsideways & 10 down form this window top left corner we put a 500
                            by 500 drawing area.

                            UpperLeftX =10
                            UpperLeftY =10

                            WindowWidth = 530
                            WindowHeight = 580

                            ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                            ' The graphic area is 'addressed' (referred to) as #w.g, called its
                            'handle'.
                            ' The whole window has handle #w. #w.g is a 'child' of the main #w.
                            graphicbox #w.g, 10, 10, 500, 500

                            ' Open the window showing this empty graphicbox
                            open "Example for Kurt of Simple Graph" for window as #w

                            ' From here on, commands starting '#w, ....' or #w.g, ....' send
                            commands to
                            ' the full window, or to its graphic subwindow.

                            ' Make sure clicking 'close' icon at top RH of #w exits cleanly.
                            #w, "trapclose [quit]"

                            ' Tell LB to put printing 'pen' down on page.
                            ' Pen at this stage will be at ( 0, 0), at top LH of graphic area.
                            #w.g, "down"

                            ' Move to a position 100 sideways and 200 down, leaving a line.
                            #w.g, "goto 100 200"

                            ' Change color and size
                            #w.g, "color red"
                            #w.g, "size 4"

                            ' Move to 200 sideways and 100 down, leaving no line.
                            #w.g, "up ; goto 200 250 ; down"

                            ' Lift pen, move to center-screen at 250, 250 and draw a colored circle.
                            #w.g, "goto 250 250"
                            #w.g, "color red ; backcolor cyan ; circlefilled 80"


                            wait

                            ' Come to here only if 'close' icon clicked.
                            [quit]
                            ' Shut the window
                            close #w
                            ' Tell LB the program has ended!
                            end
                          • RipSaw
                            Been playing w ur example - look below Happy Easter - Kurt We don t need the text-only mainwin but it may help debugging by allowing us to see values.
                            Message 13 of 22 , Apr 4, 2010
                            • 0 Attachment
                              Been playing w ur example - look below
                              Happy Easter - Kurt

                              ' We don't need the text-only 'mainwin' but it may help debugging
                              ' by allowing us to see values.
                              nomainwin
                              ' But we DO need a graphicbox area in a 'Window'
                              ' Choose size of this window (allow for scrollbars)
                              WindowWidth = 530
                              WindowHeight = 580
                              ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                              graphicbox #w.g, 0, 0, 530, 580
                              ' Open the window showing this empty graphicbox
                              open "Kurt Simple Graph" for window as #w
                              ' Make sure clicking 'close' icon at top RH exits cleanly.
                              #w, "trapclose [quit]"
                              ' Tell LB to put printing 'pen' down on page.
                              #w.g, "down"
                              ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                              #w.g, "size 2"
                              ' Work out how far apart lowest & highest x and y values are
                              xMin =-10
                              xMax = 20
                              yMin = ( 1 /2 * -10 +1)
                              yMax = ( 1 /2 * 20 +1)
                              yRange = yMax -yMin
                              xRange = xMax -xMin
                              print xRange; " "; yRange
                              Rem  WHY CAN't I print these values xRange; " "; yRange - They are real numbers
                              Rem From a REAL math formula.
                              Rem These are the "Dot" correct?
                              ' step through the x range with small steps ( try bigger/smaller steps)
                              for x= -10 to 20 step .1
                              ' Work out the function's value at eac x position.
                              y = 1 /2 *x +1
                              ' Now you need to change so x_min plots at 0 and x_max at 500
                              xScreen = int( ( x -xMin) /xRange *500)
                              ' and same for y. BUT y in LB/MS counts down from top...
                              ' so we subtract it from 500 so it counts up from bottom.
                              yScreen =500 -int( ( y -yMin) /yRange *500)
                              ' Send a 'set x y' command- it plots a dot at ( x_screen, y_screen)
                              #w.g, "set "; xScreen; " "; yScreen
                              next x
                              ' This is hard to interpret, without axes drawn. We need range ( -10, -5) to
                              ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                              ' but as before we scale, and invert y direction.
                              ' First, horiz. axis thru. origin.
                              ' Choose thicker line in colour red.
                              #w.g, "size 4 ; color red"
                              #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                              #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                              ' Now the vertical axis
                              #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                              #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                              ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)
                              ' This makes the graphics 'stick'. Otherwise if covered and then
                              ' uncovered they are eerased and not re-drawn.
                              #w.g, "flush"
                              ' Hang around for 10 seconds ( 10000 ms)
                              timer 10000, [on]
                              wait
                              [on]
                              timer 0
                              ' Put up a message for you to confirm (or not) printout.
                              confirm "Send to printer?"; answer
                              ' If wanted, do a printout..
                              if answer then #w.g, "print vga"
                              ' Wait, with graphic on-screen.wait
                              ' Come to here only if 'close' icon clicked.
                              [quit]
                              ' Shut the window
                              close #w
                              ' Tell LB the program has ended!
                              end




                              [Non-text portions of this message have been removed]
                            • RipSaw
                              John I got more qs.   Please dont get mad. - Kurt ________________________________ From: John Fisher To: libertybasic@yahoogroups.com
                              Message 14 of 22 , Apr 4, 2010
                              • 0 Attachment
                                John I got more qs.   Please dont get mad. - Kurt




                                ________________________________
                                From: John Fisher <mr.john.f@...>
                                To: libertybasic@yahoogroups.com
                                Sent: Thu, April 1, 2010 7:05:12 PM
                                Subject: Re: [libertybasic] Re: plot using EXCEL

                                 
                                Hope the following makes sense- I'd next want to add numbers and minor
                                grid lines!
                                Just copy & paste into LB/JB.
                                Try altering bits you understand a tiny bit at a time, and check what
                                happens.
                                Reverse anything that fails to do what you want!
                                We all started simple, and learned from others' code.
                                The Help files are your first source- for eg. the names of available
                                colours.

                                JohnF

                                ' We don't need the text-only 'mainwin' but it may help debugging
                                ' by allowing us to see values.
                                nomainwin
                                ' But we DO need a graphicbox area in a 'Window'
                                ' Choose size of this window (allow for scrollbars)
                                These make a box - I like bigger
                                WindowWidth = 530
                                WindowHeight = 580
                                ' Fit a 500 by 500 box to draw graphics with a nice border gap.
                                Is there anything special abt #w.g?  Can I call it pocket knife?
                                Box inside outter box - I like 0,0,600,600 - Bigger box,  fill paper.
                                graphicbox #w.g, 10, 10, 500, 500

                                ' Open the window showing this empty graphicbox
                                open "Simple Graph" for window as #w
                                ' Make sure clicking 'close' icon at top RH exits cleanly.
                                #w, "trapclose [quit]"
                                ' Tell LB to put printing 'pen' down on page.
                                #w.g, "down"
                                ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                                #w.g, "size 2"

                                ' Work out how far apart lowest & highest x and y values are
                                xMin =-10
                                xMax = 20
                                yMin = ( 1 /2 * -10 +1)
                                yMax = ( 1 /2 * 20 +1)
                                yRange = yMax -yMin
                                xRange = xMax -xMin

                                Why cant I print xRange and yRange? they are numbers from a math formula.  I get a silly error msg
                                print xRange; " "; yRange

                                ' step through the x range with small steps ( try bigger/smaller
                                steps)
                                for x= -10 to 20 step 0.1
                                ' Work out the function's value at eac x position.
                                y = 1 /2 *x +1
                                ' Now you need to change so x_min plots at 0 and x_max at 500<<<< This number 500 is that 500 pixels from BOTTOM
                                xScreen = int( ( x -xMin) /xRange *500)
                                ' and same for y. BUT y in LB/MS counts down from top...
                                ' so we subtract it from 500 so it counts up from bottom.

                                rem IF I UNDERSTAND EVERYTHING IS REFERENCED FROM BOTTOM, NEEDS OFFSET TO make plot
                                yScreen =500 -int( ( y -yMin) /yRange *500)
                                ' Send a 'set x y' command- it plots a dot at ( x_screen,
                                y_screen)
                                #w.g, "set "; xScreen; " "; yScreen
                                next x

                                ' This is hard to interpret, without axes drawn. We need range (
                                -10, -5) to
                                ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                                ' but as before we scale, and invert y direction.
                                ' First, horiz. axis thru. origin.
                                ' Choose thicker line in colour red.
                                #w.g, "size 4 ; color red"
                                Rem  I do not see a line number 0,  Is this pixel (dot) 0?
                                #w.g, "up ; goto 0 "; 500 -int( ( 0 -yMin) /yRange *500)
                                #w.g, "down ; goto 500 "; 500 -int( ( 0 -yMin) /yRange *500)
                                ' Now the vertical axis - the two xRange * 500 - they for up down vertical?
                                #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *500); " 0"
                                #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *500); " 500"
                                ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                                ' This makes the graphics 'stick'. Otherwise if covered and then
                                ' uncovered they are eerased and not re-drawn.
                                #w.g, "flush"

                                ' Hang around for 10 seconds ( 10000 ms)
                                timer 10000, [on]
                                wait
                                [on]
                                timer 0

                                ' Put up a message for you to confirm (or not) printout.
                                confirm "Send to printer?"; answer
                                ' If wanted, do a printout..
                                if answer then #w.g, "print vga"

                                ' Wait, with graphic on-screen.wait

                                ' Come to here only if 'close' icon clicked.
                                [quit]
                                ' Shut the window
                                close #w
                                ' Tell LB the program has ended!
                                end







                                [Non-text portions of this message have been removed]
                              • John Fisher
                                Keep at it! Have altered the lines where you raised queries- see lines with ************* We didn t need the text-only mainwin but it helps debugging
                                Message 15 of 22 , Apr 4, 2010
                                • 0 Attachment
                                  Keep at it!
                                  Have altered the lines where you raised queries- see lines with
                                  *************


                                  ' We didn't need the text-only 'mainwin' but it helps debugging ***********
                                  ' by allowing us to see values.
                                  ' nomainwin '********* I've 'rem'arked this out. Now you can print ***
                                  ' BUT it is a separate window.
                                  ' Underneath YOUR window. Remember to close BOTH! **********

                                  ' We DO need a graphicbox area in a 'Window'
                                  ' Choose size of this window (allow for scrollbars)
                                  ' ************** These make a box - I like bigger *******
                                  ' *******sure- up to your screensize, eg 1280 by 1024 *****
                                  ' ***** the values below allow 800x700 plus title and borders****
                                  WindowWidth = 816
                                  WindowHeight = 740

                                  ' ***** Change positioning of your window ********
                                  UpperLeftX =1
                                  UpperLeftY =1
                                  ' Fit a 800 by 700 box to draw graphics with a nice border gap.
                                  ' ************** The window could be called 'MyWin' and the
                                  ' graphicbox 'MyWin.gbox' ****************
                                  ' Is there anything special abt #w.g? No. ***************
                                  ' Box inside outer box - I like 0,0,600,600 - Bigger box, fill paper.
                                  graphicbox #w.g, 2, 2, 800, 700

                                  ' Open the window showing this empty graphicbox
                                  open "Simple Graph" for window as #w
                                  ' Make sure clicking 'close' icon at top RH exits cleanly.
                                  #w, "trapclose [quit]"
                                  ' Tell LB to put printing 'pen' down on page.
                                  #w.g, "down"
                                  ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                                  #w.g, "size 2"

                                  ' Work out how far apart lowest & highest x and y values are
                                  xMin =-10
                                  xMax = 20
                                  yMin = ( 1 /2 * -10 +1)
                                  yMax = ( 1 /2 * 20 +1)
                                  yRange = yMax -yMin
                                  xRange = xMax -xMin

                                  'Why cant I print xRange and yRange? they are numbers from
                                  ' a math formula. I get a silly error msg ********************
                                  print xRange; " "; yRange ' It prints to the OTHER mainwin *****

                                  ' step through the x range with small steps ( try bigger/smaller steps)
                                  for x= -10 to 20 step 0.1
                                  ' Work out the function's value at each x position.
                                  y = 1 /2 *x +1
                                  ' Now you need to change so x_min plots at 0 and x_max at 800
                                  ' <<<< This number 500 is that 500 pixels from BOTTOM.***** YES

                                  xScreen = int( ( x -xMin) /xRange *800)
                                  ' and same for y. BUT y in LB/MS counts down from top...
                                  ' so we subtract it from 500 so it counts up from bottom.

                                  rem IF I UNDERSTAND EVERYTHING IS REFERENCED FROM BOTTOM, NEEDS OFFSET
                                  TO make plot
                                  ' ****** the 700 below IS the offset. On its own LB counts down from
                                  the top for y.***
                                  ' **** by adding offset 700 then SUBTRACTING calc'd y we **********
                                  ' **** find ourselves displaying back upwards from bottom, as
                                  wanted.*****
                                  yScreen =700 -int( ( y -yMin) /yRange *700)
                                  ' Send a 'set x y' command- it plots a dot at ( x_screen,y_screen)
                                  #w.g, "set "; xScreen; " "; yScreen
                                  next x

                                  ' This is hard to interpret, without axes drawn. We need range (-10, -5) to
                                  ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                                  ' but as before we scale, and invert y direction.
                                  ' First, horiz. axis thru. origin.
                                  ' Choose thicker line in colour red.
                                  #w.g, "size 4 ; color red"
                                  Rem I do not see a line number 0, Is this pixel (dot) 0? *******
                                  ' ******** This line sets a size 4-pixel-wide red pen.

                                  #w.g, "up ; goto 0 "; 700 -int( ( 0 -yMin) /yRange *700)
                                  #w.g, "down ; goto 800 "; 700 -int( ( 0 -yMin) /yRange *700)
                                  ' Now the vertical axis - the two xRange * 500 - they for up down vertical?
                                  #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *800); " 0"
                                  #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *800); " 700"
                                  ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                                  ' This makes the graphics 'stick'. Otherwise if covered and then
                                  ' uncovered they are eerased and not re-drawn.
                                  #w.g, "flush"

                                  ' Hang around for 10 seconds ( 10000 ms)
                                  timer 10000, [on]
                                  wait
                                  [on]
                                  timer 0

                                  ' Put up a message for you to confirm (or not) printout.
                                  confirm "Send to printer?"; answer
                                  ' If wanted, do a printout..
                                  if answer then #w.g, "print vga"

                                  ' Wait, with graphic on-screen.wait

                                  ' Come to here only if 'close' icon clicked.
                                  [quit]
                                  ' Shut the window
                                  close #w
                                  ' Tell LB the program has ended!
                                  end
                                • John Fisher
                                  Hi Kurt, You might like to look at one of my web pages at http://www.diga.me.uk/graphics2.lsn Save the fille; double click to load the lesson into LB. Items
                                  Message 16 of 22 , Apr 4, 2010
                                  • 0 Attachment
                                    Hi Kurt,
                                    You might like to look at one of my web pages at
                                    http://www.diga.me.uk/graphics2.lsn
                                    Save the fille; double click to load the lesson into LB. Items with +
                                    signs need double-clicking to read subsections.
                                    One of the files needs http://www.diga.me.uk/bg2.bmp, but the rest
                                    should run.
                                    The lessons get more and more complicated- don't expect to understand
                                    more than the first few.
                                    John
                                  • RipSaw
                                    I cherish ur help.  When I was in tech school,  We had an instructor he used to tell me how stupid I was.  Made me feel good. I wish u were here,  many
                                    Message 17 of 22 , Apr 4, 2010
                                    • 0 Attachment
                                      I cherish ur help.  When I was in tech school,  We had an instructor he used to tell me how stupid I was.  Made me feel good.
                                      I wish u were here,  many dark ale, ribs,  or grilled hamburgers.    LOTS OF qs.   It wud be so much easier if someone was here to help me.
                                      Tkz - Kurt




                                      ________________________________
                                      From: John Fisher <mr.john.f@...>
                                      To: libertybasic@yahoogroups.com
                                      Sent: Sun, April 4, 2010 4:22:23 PM
                                      Subject: Re: [libertybasic] Re: plot using EXCEL

                                       
                                      Hi Kurt,
                                      You might like to look at one of my web pages at
                                      http://www.diga me.uk/graphics2. lsn
                                      Save the fille; double click to load the lesson into LB. Items with +
                                      signs need double-clicking to read subsections.
                                      One of the files needs http://www.diga me.uk/bg2. bmp, but the rest
                                      should run.
                                      The lessons get more and more complicated- don't expect to understand
                                      more than the first few.
                                      John






                                      [Non-text portions of this message have been removed]
                                    • RipSaw
                                        Can I use EasterEgg instead of w.g? graphicbox #w.g, 2, 2, 800, 700 OK 2, 2 is the border AROUND THE inner box - I dont like borders so I make it
                                      Message 18 of 22 , Apr 4, 2010
                                      • 0 Attachment
                                         
                                        Can I use "EasterEgg" instead of w.g?

                                        graphicbox #w.g, 2, 2, 800, 700
                                        OK 2, 2 is the border AROUND THE inner box - I dont like borders so I make it
                                        graphicbox #w.g, 0, 0, 800, 700
                                        800 is the vertical height 700 wide correct
                                         
                                        Where do I close BOTH windows?   window for lovely plot and window for data?
                                         
                                        ALL GRAPHICS PIXELS are from upper top left!  BUT WE MUST "trick" LB to an offset from bottom  -  TRUE/ FALSE?
                                         
                                        This line below, is how we plot the pixels  -  we "SET"     AM I CORRECT?
                                        #w.g, "set "; xScreen; " "; yScreen
                                         
                                        Im used to having a pretty 18 19 yr old keep me up all night! not a silly basic program!



                                        ________________________________
                                        From: John Fisher <mr.john.f@...>
                                        To: libertybasic@yahoogroups.com
                                        Sent: Sun, April 4, 2010 3:06:34 PM
                                        Subject: Re: [libertybasic] Re: plot using EXCEL

                                         
                                        Keep at it!
                                        Have altered the lines where you raised queries- see lines with
                                        ************ *

                                        ' We didn't need the text-only 'mainwin' but it helps debugging ***********
                                        ' by allowing us to see values.
                                        ' nomainwin '********* I've 'rem'arked this out. Now you can print ***
                                        ' BUT it is a separate window.
                                        ' Underneath YOUR window. Remember to close BOTH! **********

                                        ' We DO need a graphicbox area in a 'Window'
                                        ' Choose size of this window (allow for scrollbars)
                                        ' ************ ** These make a box - I like bigger *******
                                        ' *******sure- up to your screensize, eg 1280 by 1024 *****
                                        ' ***** the values below allow 800x700 plus title and borders****
                                        WindowWidth = 816
                                        WindowHeight = 740

                                        ' ***** Change positioning of your window ********
                                        UpperLeftX =1
                                        UpperLeftY =1
                                        ' Fit a 800 by 700 box to draw graphics with a nice border gap.
                                        ' ************ ** The window could be called 'MyWin' and the
                                        ' graphicbox 'MyWin.gbox' ************ ****
                                        ' Is there anything special abt #w.g? No. ************ ***
                                        ' Box inside outer box - I like 0,0,600,600 - Bigger box, fill paper.
                                        graphicbox #w.g, 2, 2, 800, 700

                                        ' Open the window showing this empty graphicbox
                                        open "Simple Graph" for window as #w
                                        ' Make sure clicking 'close' icon at top RH exits cleanly.
                                        #w, "trapclose [quit]"
                                        ' Tell LB to put printing 'pen' down on page.
                                        #w.g, "down"
                                        ' Tell LB we want a rather bigger dot size than the normal 1 pixel.
                                        #w.g, "size 2"

                                        ' Work out how far apart lowest & highest x and y values are
                                        xMin =-10
                                        xMax = 20
                                        yMin = ( 1 /2 * -10 +1)
                                        yMax = ( 1 /2 * 20 +1)
                                        yRange = yMax -yMin
                                        xRange = xMax -xMin

                                        'Why cant I print xRange and yRange? they are numbers from
                                        ' a math formula. I get a silly error msg ************ ********
                                        print xRange; " "; yRange ' It prints to the OTHER mainwin *****

                                        ' step through the x range with small steps ( try bigger/smaller steps)
                                        for x= -10 to 20 step 0.1
                                        ' Work out the function's value at each x position.
                                        y = 1 /2 *x +1
                                        ' Now you need to change so x_min plots at 0 and x_max at 800
                                        ' <<<< This number 500 is that 500 pixels from BOTTOM.***** YES

                                        xScreen = int( ( x -xMin) /xRange *800)
                                        ' and same for y. BUT y in LB/MS counts down from top...
                                        ' so we subtract it from 500 so it counts up from bottom.

                                        rem IF I UNDERSTAND EVERYTHING IS REFERENCED FROM BOTTOM, NEEDS OFFSET
                                        TO make plot
                                        ' ****** the 700 below IS the offset. On its own LB counts down from
                                        the top for y.***
                                        ' **** by adding offset 700 then SUBTRACTING calc'd y we **********
                                        ' **** find ourselves displaying back upwards from bottom, as
                                        wanted.*****
                                        yScreen =700 -int( ( y -yMin) /yRange *700)
                                        ' Send a 'set x y' command- it plots a dot at ( x_screen,y_screen)
                                        #w.g, "set "; xScreen; " "; yScreen
                                        next x

                                        ' This is hard to interpret, without axes drawn. We need range (-10, -5) to
                                        ' ( 20, 11) to be shown, with zero axes through ( 0, 0),
                                        ' but as before we scale, and invert y direction.
                                        ' First, horiz. axis thru. origin.
                                        ' Choose thicker line in colour red.
                                        #w.g, "size 4 ; color red"
                                        Rem I do not see a line number 0, Is this pixel (dot) 0? *******
                                        ' ******** This line sets a size 4-pixel-wide red pen.

                                        #w.g, "up ; goto 0 "; 700 -int( ( 0 -yMin) /yRange *700)
                                        #w.g, "down ; goto 800 "; 700 -int( ( 0 -yMin) /yRange *700)
                                        ' Now the vertical axis - the two xRange * 500 - they for up down vertical?
                                        #w.g, "up ; goto "; int( ( 0 -xMin) /xRange *800); " 0"
                                        #w.g, "down ; goto "; int( ( 0 -xMin) /xRange *800); " 700"
                                        ' Should see now it goes from (-10, -4) through ( 0, 1) to ( 20, 11)

                                        ' This makes the graphics 'stick'. Otherwise if covered and then
                                        ' uncovered they are eerased and not re-drawn.
                                        #w.g, "flush"

                                        ' Hang around for 10 seconds ( 10000 ms)
                                        timer 10000, [on]
                                        wait
                                        [on]
                                        timer 0

                                        ' Put up a message for you to confirm (or not) printout.
                                        confirm "Send to printer?"; answer
                                        ' If wanted, do a printout..
                                        if answer then #w.g, "print vga"

                                        ' Wait, with graphic on-screen.wait

                                        ' Come to here only if 'close' icon clicked.
                                        [quit]
                                        ' Shut the window
                                        close #w
                                        ' Tell LB the program has ended!
                                        end








                                        [Non-text portions of this message have been removed]
                                      • John Fisher
                                        Can I use EasterEgg instead of w.g? No. But if you created a window called Easter you could have in it a graphicbox called Easter.Egg The dot indicates
                                        Message 19 of 22 , Apr 5, 2010
                                        • 0 Attachment
                                          Can I use "EasterEgg" instead of w.g?
                                          No. But if you created a window called 'Easter' you could have in it a
                                          graphicbox called 'Easter.Egg'
                                          The dot indicates Easter.Egg is a 'child' or part of 'Easter'

                                          graphicbox #w.g, 2, 2, 800, 700
                                          OK 2, 2 is the border AROUND THE inner box - I dont like borders so I
                                          make it
                                          graphicbox #w.g, 0, 0, 800, 700
                                          800 is the vertical height 700 wide correct?
                                          No. The first two numbers are how far sideways & down from the top left
                                          to place the 800 by 700 box.
                                          However, in effect it was leaving a border of 2 on top and left. On
                                          right and bottom you have what's left after putting the 800x700 box
                                          wherever you chose.
                                          800 is horizontal, 700 vertical.
                                          It is ALWAYS across then down

                                          Where do I close BOTH windows? window for lovely plot and window for data?
                                          As the person running the computer, YOU do, at present, by clicking the
                                          windows closed.
                                          That's the 'wait' command.
                                          You could tell the computer to itself close YOUR window (after a delay)
                                          But you'll always have to close mainwindows yourself.
                                          Most of us only use it when debugging, and rem it out afterwards.

                                          ALL GRAPHICS PIXELS are from upper top left! BUT WE MUST "trick" LB to
                                          an offset from bottom - TRUE/ FALSE?
                                          Yes. If you want to think the normal Cartesian way from bottom left
                                          across and up you ADD offset to reach bottom, then subtract y to move UP.

                                          This line below, is how we plot the pixels - we "SET" AM I CORRECT?
                                          #w.g, "set "; xScreen; " "; yScreen
                                          Yes. Generally it will amount to eg 'set 500 200'.
                                          If xScreen is 20 and yScreen 50, you have to put them together in a
                                          string and YOU have to remember to add the spaces.
                                          Beginners often miss the space after 'set ' or the space between the two
                                          numbers.
                                        • RipSaw
                                          BINGO!!!!!!!! Now its starting to cone together.   Thank you for not yelling at me or calling me stupid.  I once took a job where math classes was
                                          Message 20 of 22 , Apr 5, 2010
                                          • 0 Attachment
                                            BINGO!!!!!!!! Now its starting to cone together.   Thank you for not yelling at me or calling me stupid.  I once took a job where math classes was required.   It was a complete study class of my two year degree all over.  The peron that ran the generators was hired and had NO math at all behind him.  The math classes were required.   He did the correspondence classes (home study) or look for another job.

                                            I sat with him for months trying to teach hi school algebra,  trig,  log tables.   I used the squares in the floor  12 in wide, 12 in square the diagonal will always be sqrt 2 * side.  I thought of ways to take a blank stare and turn it into a smile.   It took months.  He got it! I felt good - I really did.  Never once did I call him stupid.   Thank u for putting up w me.

                                            Lets see - its 6:32 am here, so over there - its abt lunch time - A nice glass of port or sherry to u.   (and a very large roast beef sandwich)
                                            I wud offer u a glass of beer, but I herd that American beer is like drinking water.   Uk Beer is heavier.   God bless u.

                                            I am playing w ur examples and having fun.    I did change little things,  like the step in the "For" loop.    I have a hard copy here on desk.  Old homes and computers dont go toether,  no room on desk and computers.   -  Kurt




                                            ________________________________
                                            From: John Fisher <mr.john.f@...>
                                            To: libertybasic@yahoogroups.com
                                            Sent: Mon, April 5, 2010 4:18:36 AM
                                            Subject: Re: [libertybasic] Re: plot using EXCEL

                                             
                                            Can I use "EasterEgg" instead of w.g?
                                            No. But if you created a window called 'Easter' you could have in it a
                                            graphicbox called 'Easter.Egg'
                                            The dot indicates Easter.Egg is a 'child' or part of 'Easter'

                                            graphicbox #w.g, 2, 2, 800, 700
                                            OK 2, 2 is the border AROUND THE inner box - I dont like borders so I
                                            make it
                                            graphicbox #w.g, 0, 0, 800, 700
                                            800 is the vertical height 700 wide correct?
                                            No. The first two numbers are how far sideways & down from the top left
                                            to place the 800 by 700 box.
                                            However, in effect it was leaving a border of 2 on top and left. On
                                            right and bottom you have what's left after putting the 800x700 box
                                            wherever you chose.
                                            800 is horizontal, 700 vertical.
                                            It is ALWAYS across then down

                                            Where do I close BOTH windows? window for lovely plot and window for data?
                                            As the person running the computer, YOU do, at present, by clicking the
                                            windows closed.
                                            That's the 'wait' command.
                                            You could tell the computer to itself close YOUR window (after a delay)
                                            But you'll always have to close mainwindows yourself.
                                            Most of us only use it when debugging, and rem it out afterwards.

                                            ALL GRAPHICS PIXELS are from upper top left! BUT WE MUST "trick" LB to
                                            an offset from bottom - TRUE/ FALSE?
                                            Yes. If you want to think the normal Cartesian way from bottom left
                                            across and up you ADD offset to reach bottom, then subtract y to move UP.

                                            This line below, is how we plot the pixels - we "SET" AM I CORRECT?
                                            #w.g, "set "; xScreen; " "; yScreen
                                            Yes. Generally it will amount to eg 'set 500 200'.
                                            If xScreen is 20 and yScreen 50, you have to put them together in a
                                            string and YOU have to remember to add the spaces.
                                            Beginners often miss the space after 'set ' or the space between the two
                                            numbers.






                                            [Non-text portions of this message have been removed]
                                          Your message has been successfully submitted and would be delivered to recipients shortly.