June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,6 +1,8 @@
using PyPlot
using Plots
plotlyjs()
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]
plot(x,y, "bo")
savefig("qsort-range-10-9.png")
p = scatter(x, y)
savefig(p, "/tmp/testplot.png")

View file

@ -0,0 +1,39 @@
// Version 1.2.31
import org.jfree.chart.ChartFactory
import org.jfree.chart.ChartPanel
import org.jfree.data.xy.XYSeries
import org.jfree.data.xy.XYSeriesCollection
import org.jfree.chart.plot.PlotOrientation
import javax.swing.JFrame
import javax.swing.SwingUtilities
import java.awt.BorderLayout
fun main(args: Array<String>) {
val x = intArrayOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
val y = doubleArrayOf(
2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0
)
val series = XYSeries("plots")
(0 until x.size).forEach { series.add(x[it], y[it]) }
val labels = arrayOf("Plot Demo", "X", "Y")
val data = XYSeriesCollection(series)
val options = booleanArrayOf(false, true, false)
val orient = PlotOrientation.VERTICAL
val chart = ChartFactory.createXYLineChart(
labels[0], labels[1], labels[2], data, orient, options[0], options[1], options[2]
)
val chartPanel = ChartPanel(chart)
SwingUtilities.invokeLater {
val f = JFrame()
with(f) {
defaultCloseOperation = JFrame.EXIT_ON_CLOSE
add(chartPanel, BorderLayout.CENTER)
title = "Plot coordinate pairs"
isResizable = false
pack()
setLocationRelativeTo(null)
isVisible = true
}
}
}

View file

@ -1,16 +1,15 @@
use SVG;
use SVG::Plot;
my @x = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
my @x = 0..9;
my @y = (2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0);
my $svg = SVG::Plot.new(
say SVG.serialize: SVG::Plot.new(
width => 512,
height => 512,
x => @x,
x-tick-step => { 1 },
values => [@y],
min-y-axis => 0,
values => [@y,],
title => 'Coordinate Pairs',
).plot(:xy-lines);
say SVG.serialize($svg);

View file

@ -0,0 +1,78 @@
# Project : Plot coordinate pairs
# Date : 2018/01/11
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
load "guilib.ring"
paint = null
new qapp
{
win1 = new qwidget() {
setwindowtitle("Plot coordinate pairs")
setgeometry(100,100,1024,900)
label1 = new qlabel(win1) {
setgeometry(10,10,1024,900)
settext("")
}
new qpushbutton(win1) {
setgeometry(50,50,100,30)
settext("draw")
setclickevent("draw()")
}
show()
}
exec()
}
func draw
p1 = new qpicture()
color = new qcolor() {
setrgb(0,0,255,255)
}
pen = new qpen() {
setcolor(color)
setwidth(1)
}
paint = new qpainter() {
begin(p1)
setpen(pen)
old = 0
yold = 0
xnew = 0
ynew = 0
x2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y2 = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]
for x = 1 to 9
drawline(100*x,720,100*x,0)
drawtext(100*x,750,string(x))
next
for y = 20 to 180 step 20
drawline(900,4*y,0,4*y)
drawtext(0,720-4*y,string(y))
next
drawline(0,0,0,720)
drawline(0,0,900,0)
for i = 1 to 10
if i=1
xold = 100*x2[i]
yold = 720-4*y2[i]
else
xnew = 100*x2[i]
ynew = 720-4*y2[i]
drawline(xold,yold,xnew,ynew)
xold = xnew
yold = ynew
ok
next
endpaint()
}
label1 { setpicture(p1) show() }
return