Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,9 @@
(lib 'plot)
(define ys #(2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0) )
(define (f n) [ys n])
(plot-sequence f 9)
→ (("x:auto" 0 9) ("y:auto" 2 198))
(plot-grid 1 20)
(plot-text " Rosetta plot coordinate pairs" 0 10 "white")

View file

@ -0,0 +1,12 @@
require('GD::Graph::points')
var data = [
[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],
]
var graph = %s'GD::Graph::points'.new(400, 300)
var gd = graph.plot(data)
var format = 'png'
File("qsort-range.#{format}").write(gd.(format), :raw)

View file

@ -0,0 +1 @@
jq -n -M -r -f plot.jq | R CMD BATCH plot.R

View file

@ -0,0 +1,20 @@
# NOTE: This definition of transpose can be omitted
# if your version of jq includes transpose as a builtin.
#
# transpose a possibly jagged matrix, quickly;
# rows are padded with nulls so the result is always rectangular.
def transpose:
if . == [] then []
else . as $in
| (map(length) | max) as $max
| length as $length
| reduce range(0; $max) as $j
([]; . + [reduce range(0;$length) as $i ([]; . + [ $in[$i][$j] ] )] )
end;
def x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
def y: [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0];
def plot(x;y): "A,B", ( [x,y] | transpose | map( @csv ) | .[]);
plot(x;y)

View file

@ -0,0 +1,8 @@
mydata <- read.table( file("stdin"), header=TRUE, sep=",")
x = mydata$A # x-axis
y = mydata$B # y-axis
plot(x, y, # plot the variables
main="Scatterplot Example",
xlab="x-axis label", # x-axis label
ylab="y-axis label" ) # y-axis label