Plot coordinate pairs: Difference between revisions
Content deleted Content added
(12 intermediate revisions by 7 users not shown) | |||
Line 1,258:
=={{header|EasyLang}}==
[https://easylang.online/show/#cod=hVBBasMwELzrFQO9taBKVhxbh/YjRoeQKK3AlsEWqdzXd1dx2iQt1GCYndndWU3uHF7QQUGjgsEGNbZo0MLCiWVVK9nQ38JouYFppUbdSoVmKytopWQNbRQRemOlgW4ZO/EAse/9bhJ9iP4jHNI7qFUM48nTFGxTBIb1GdmaUPI5zeHTw4hI5r2PyJ0TA2EljuOEQEgjjYgCQDhi6YLDKwYu6eNOpriUQt64azGnhfQBh3CCXfdNu/jm6XrFI5fzajyR9Liy3/fdsKW3otCuSX5AKcmK7OeUyTB30f3jySOWNpU8LpZXJOX1R6u+s8xkuR978rBK3SX/O73zaRQf73vm8bKVpWWNsdBLeR1pP5dl8OvEFw== Run it]
<syntaxhighlight lang=
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
line 10
line 95
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
move
move
.
stx = x[n] div 9
for i
move i * 9 + 10
move i * 9 + 10
.
color 900
linewidth 0.5
for i = 1 to n
x = x[i] * 9 / stx + 10
y =
.
</syntaxhighlight>
Line 1,362 ⟶ 1,359:
=={{header|Fōrmulæ}}==
{{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,186 ⟶ 2,185:
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
".." (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>▼
▲
</syntaxhighlight>
[http://img28.picoodle.com/img/img28/4/2/7/f_qsortrange1m_1b7f493.png qsort-range-10-9.png]
Line 2,194 ⟶ 2,196:
=={{header|Nim}}==
===Using gnuplot===
{{libheader|
There exists two libraries providing a Nim interface to “gnuplot” (the GNU plotting program), which are named “gnuplot” and “gnuplotlib”. We have chosen the
The library launches “gnuplot” which does the plotting. From “gnuplot”, it is possible to save the drawing into a PDF, a SVG or an image (BMP, PNG) file.
Line 2,205 ⟶ 2,207:
y = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]
withGnuPlot:
plot(x, y, "Coordinate pairs")
</syntaxhighlight>
===Using ggplotnim===
Line 2,289 ⟶ 2,292:
=={{header|PARI/GP}}==
<syntaxhighlight lang="parigp">plothraw(vx, vy)</syntaxhighlight>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
uses PlotWPF;
begin
var x := |0.0, 1, 2, 3, 4, 5, 6, 7, 8, 9|;
var y := |2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0|;
var plot := new MarkerGraphWPF(x, y);
plot.addlinegraph(x, y);
end.
</syntaxhighlight>
[[File:Plot_PascalABC.png]]
=={{header|Perl}}==
Line 2,866 ⟶ 2,882:
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,173 ⟶ 3,208:
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="
import "dome" for Window
import "math" for Point
|