Plot coordinate pairs: Difference between revisions
Content added Content deleted
(→{{header|C}}: EPS writer) |
|||
Line 422: | Line 422: | ||
=={{header|Liberty BASIC}}== |
=={{header|Liberty BASIC}}== |
||
First version writes directly to LB's concsole window. |
|||
<lang lb> |
<lang lb> |
||
'Plotting coordinate pairs MainWin - Style |
'Plotting coordinate pairs MainWin - Style |
||
Line 456: | Line 457: | ||
Next i |
Next i |
||
End |
|||
⚫ | |||
</lang> |
|||
⚫ | |||
The second version uses the more typical graphic window approach, and is written to enable easy adaptation to other data sets. |
|||
⚫ | |||
<lang lb> |
|||
⚫ | |||
nomainwin |
|||
⚫ | |||
⚫ | |||
DATA 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
|||
DATA 2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0 |
|||
For i = 0 To 9 |
For i = 0 To 9 |
||
READ tmp: x( i) = tmp |
|||
Print #gwin, "Place " + str$((i * 40) + 25) + " 440" |
|||
⚫ | |||
Next i |
Next i |
||
For i = 0 To |
For i = 0 To 9 |
||
READ tmp: y( i) = tmp |
|||
Print #gwin, "|" +Right$(" " + str$(i * 10), 3) + "-" |
|||
Next i |
Next i |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'25, 418 is 0,0 |
|||
global offsetX, offsetY, scaleX, scaleY |
|||
offsetX = 25: offsetY = 418 |
|||
scaleX = 40: scaleY = 2 |
|||
maxX = 9: maxY = 200 |
|||
#gwin "line "; sx( maxX);" "; sy( 0);" "; sx( 0); " "; sy( 0) |
|||
#gwin "goto "; sx( 0); " "; sy( maxY) |
|||
For x = 0 To 9 |
|||
#gwin "place ";sx(x);" ";sy(0) |
|||
⚫ | |||
⚫ | |||
Next |
|||
#gwin "turn 90" |
|||
For y = 0 To 200 Step 20 |
|||
#gwin "place ";sx(0);" ";sy(y) |
|||
⚫ | |||
#gwin "place ";0;" ";sy(y) |
|||
#gwin "|"; y |
|||
Next |
|||
#gwin "size 3" |
|||
For i = 0 To 9 |
For i = 0 To 9 |
||
#gwin "set ";sx(x(i));" ";sy(y(i)) |
|||
⚫ | |||
Next i |
Next i |
||
#gwin "Flush" |
|||
Print #gwin, "Place 25 415" |
|||
Print #gwin, "GoTo 25 14" |
|||
Print #gwin, "Place 25 415" |
|||
Print #gwin, "GoTo 387 415" |
|||
⚫ | |||
Wait |
Wait |
||
[quit.gwin] |
[quit.gwin] |
||
Close #gwin |
Close #gwin |
||
End |
End |
||
'x, y to screen x, y |
|||
function sx(x) |
|||
sx = offsetX +x*scaleX |
|||
end function |
|||
function sy(y) |
|||
sy = offsetY-y*scaleY 'y is inverted |
|||
end function |
|||
</lang> |
|||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |