Plot coordinate pairs: Difference between revisions

m
 
(6 intermediate revisions by 5 users not shown)
Line 1,258:
 
=={{header|EasyLang}}==
[https://easylang.online/show/#cod=hVBBasMwELzrFQO9taBKVhxbh/YjRoeQKK3AlsEWqdzXd1dx2iQt1GCYndndWU3uHF7QQUGjgsEGNbZo0MLCiWVVK9nQ38JouYFppUbdSoVmKytopWQNbRQRemOlgW4ZO/EAse/9bhJ9iP4jHNI7qFUM48nTFGxTBIb1GdmaUPI5zeHTw4hI5r2PyJ0TA2EljuOEQEgjjYgCQDhi6YLDKwYu6eNOpriUQt64azGnhfQBh3CCXfdNu/jm6XrFI5fzajyR9Liy3/fdsKW3otCuSX5AKcmK7OeUyTB30f3jySOWNpU8LpZXJOX1R6u+s8xkuR978rBK3SX/O73zaRQf73vm8bKVpWWNsdBLeR1pP5dl8OvEFw== Run it]
[https://easylang.online/apps/_plot_coord.html Run it]
 
<syntaxhighlight lang="text">
x[] = [ 0 1 2 3 4 5 6 7 8 9 ]
y[] = [ 2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0 ]
Line 1,279 ⟶ 1,280:
sty = m div 9
for i range0 10
move 2 4 + i * 10
text i * sty
move 10 5 + i * 10
line 95 5 + i * 10
move 2 4 + i * 10
text i * sty
.
stx = x[n] div 9
for i range0 10
move i * 9 + 10 5
line i * 9 + 10 97
move i * 9 + 10 1
text i * stx
move i * 9 + 10 5
line i * 9 + 10 97
.
color 900
Line 1,296 ⟶ 1,297:
x = x[i] * 9 / stx + 10
y = y[i] / sty * 10 + 5
ifline ix = 1y
move x y
else
line x y
.
.
</syntaxhighlight>
Line 1,363 ⟶ 1,360:
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Plot_coordinate_pairs}}
 
'''Solution'''
 
[[File:Fōrmulæ - Plot coordinate pairs 01.png]]
 
[[File:Fōrmulæ - Plot coordinate pairs 02.png]]
 
=={{header|FreeBASIC}}==
Line 2,182 ⟶ 2,185:
=={{header|Maxima}}==
 
<syntaxhighlight lang="maxima">(%i1) ".." (m, n) := makelist (i, i, m, n); infix ("..")$
".." (m, n) := makelist (i, i, m, n); infix ("..")$
(%i2) x: 0 .. 9$ y:[2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]$
x: 0 .. 9$
(%i3) plot2d(['discrete, x, y], [style, [points,5,1,1]], [gnuplot_term, png], [gnuplot_out_file, "qsort-range-10-9.png"])$</syntaxhighlight>
(%i2) x: 0 .. 9$ y:[2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]$
(%i3) plot2dwxplot2d(['discrete, x, y], [style, [points,5,1,1]], [gnuplot_term, png], [gnuplot_out_file, "qsort-range-10-9.png"])$</syntaxhighlight>
</syntaxhighlight>
[http://img28.picoodle.com/img/img28/4/2/7/f_qsortrange1m_1b7f493.png qsort-range-10-9.png]
Line 2,863 ⟶ 2,869:
 
https://www.dropbox.com/s/q6tra0cqoty4pya/Plot.jpg?dl=0
 
=={{header|RPL}}==
{{works with|HP|48G}}
[[File:PlotPairs.png|thumb|alt=HP-48G emulator screenshot|HP-48G emulator screenshot]]
≪ → x y
≪ ERASE <span style="color:grey">@ clear graphics display</span>
x 0 + ≪ MIN ≫ STREAM x ≪ MAX ≫ STREAM XRNG <span style="color:grey">@ set x range</span>
y 0 + ≪ MIN ≫ STREAM y ≪ MAX ≫ STREAM YRNG <span style="color:grey">@ set y range</span>
1 x SIZE '''FOR''' j
x j GET y j GET R→C <span style="color:grey">@ generate coordinates pair </span>
'''IF''' j 1 > '''THEN''' SWAP OVER LINE '''END''' <span style="color:grey">@ draw a line from previous pair</span>
'''NEXT''' DROP
{ (0,0) 10 "x" "y" } AXES DRAX LABEL <span style="color:grey">@ draw axes and labels </span>
{ } PVIEW <span style="color:grey">@ display graphics </span>
≫ ≫ '<span style="color:blue">PLOTXY</span>' STO
 
{0 1 2 3 4 5 6 7 8 9}
{2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0}
<span style="color:blue">PLOTXY</span>
 
=={{header|Ruby}}==
Line 3,170 ⟶ 3,195:
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, ImageData, Color
import "dome" for Window
import "math" for Point
2,008

edits