Swiftpack.co - Package - jantomec/PlotKit

PlotKit

Swift package for ploting. Works on MacOS and on iOS. Main function plot creates a CGImage that can be used then as the data source for UIImage.

Demo:

let x: [[CGFloat]] = [linspace(from: 0, to: 10, n: 31), linspace(from: 5, to: 15, n: 31)]
let y0 = x[0].map { pow($0, 2) }
let y1 = x[1].map { 90-400*pow($0, -1) }
        
let opts: [PKPlotOption : Any] = [
    .connected : true,
    .xlimit : (CGFloat(0), CGFloat(18))
]
        
let graph = plot(x: x, y: [y0, y1], size: imageView!.frame.size, options: opts)
        
imageView.image = UIImage(cgImage: graph!)

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

First working version - 2019-10-30 11:18:24

- 2019-10-30 09:15:06

- 2019-10-30 08:54:30

- 2019-10-29 11:45:37

- 2019-10-29 10:56:26

- 2019-10-28 09:16:22