Plot coordinate pairs: Difference between revisions

m
(Replacing "gnuplot" with "gnuplotlib".)
 
(8 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,265 ⟶ 1,266:
clear
linewidth 0.5
move 10 397
line 10 955
line 95 955
textsize 3
n = len x[]
m = 0
for i = 1 to n
if y[i] > m
m = y[i]
.
.
linewidth 0.1
sty = m div 9
for i =range0 0 to 910
move 210 945 -+ i * 10
text line 95 5 + i * sty10
move 102 954 -+ i * 10
line 95 95 -text i * 10sty
.
stx = x[n] div 9
for i =range0 0 to 910
move i * 9 + 10 96.5
text line i * stx9 + 10 97
move i * 9 + 10 951
line text i * 9 + 10 3stx
.
color 900
linewidth 0.5
for i = 1 to n
x = x[i] * 9 / stx + 10
y = 100 - (y[i] / sty * 10 + 5)
if iline =x 1y
move x y
else
line x y
.
.
</syntaxhighlight>
Line 1,362 ⟶ 1,359:
=={{header|Fōrmulæ}}==
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Plot_coordinate_pairs}}
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for storage and transfer purposes more than visualization and edition.
 
'''Solution'''
 
[[File:Fōrmulæ - Plot coordinate pairs 01.png]]
Programs in Fōrmulæ are created/edited online in its [https://formulae.org website], However they run on execution servers. By default remote servers are used, but they are limited in memory and processing power, since they are intended for demonstration and casual use. A local server can be downloaded and installed, it has no limitations (it runs in your own computer). Because of that, example programs can be fully visualized and edited, but some of them will not run if they require a moderate or heavy computation/memory resources, and no local server is being used.
 
[[File:Fōrmulæ - Plot coordinate pairs 02.png]]
In '''[https://formulae.org/?example=Plot_coordinate_pairs this]''' page you can see the program(s) related to this task and their results.
 
=={{header|FreeBASIC}}==
Line 2,186 ⟶ 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,867 ⟶ 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,174 ⟶ 3,195:
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, ImageData, Color
import "dome" for Window
import "math" for Point
1,973

edits