OS X plotting framework

Overview

PlotKit

CocoaPods Compatible Carthage Compatible

Plots made easy.

PlotKit Plot

Features

  • 2D line and scatter plots
  • Multiple axes
  • Custom tick marks

Usage

To start using PlotKit quickly use the plotPoints helper function. It takes a list of points and returns a view that you can use in your app:

import PlotKit

// Generate some data to plot
let count = 1024
let t = (0..<count).map({ 2*M_PI * Double($0) / Double(count-1) })
let y = t.map({ sin($0) })

// Create a PlotView
let plotView1 = plotPoints((0..<count).map{ Point(x: t[$0], y: y[$0]) }, hTicks: .fit(6), vTicks: .fit(4))

Multiple point sets

You can have multiple curves or scatter plots in the same PlotView.

let plotView = PlotView()

let pointSet1 = PointSet(values: values1)
pointSet1.pointType = .disk(radius: 2)
pointSet2.pointColor = .red
pointSet1.lineColor = nil
plotView.addPointSet(pointSet1)

let pointSet2 = PointSet(values: values2)
pointSet2.pointType = .none
pointSet2.lineColor = .blue
plotView.addPointSet(pointSet2)

Axes

You can customize your plot axes. You can have as many axis lines as you want on the same plot.

let plotView = PlotView()

var xaxis = Axis(orientation: .horizontal, ticks: .fit(5))
xaxis.position = .value(0) 
xaxis.color = .blue
xaxis.labelAttributes = [NSForegroundColorAttributeName: NSColor.blue]
plotView.addAxis(xaxis)

var yaxis = Axis(orientation: .vertical, ticks: .distance(1))
yaxis.lineWidth = 2
plotView.addAxis(yaxis)

You can specify ticks in one of three ways:

  • fit(n): Say how many tick marks you want. PlotKit will space them evenly.
  • distance(d): Say how far appart to place tick marks.
  • list(l): Specify exactly the tick marks you want. This is the most flexible. You get to decide where to put the tick marks and also what their labels, line length and line thickness are.

Using PlotKit with Storyboards

If you want to use a PlotView in a Storyboard add an NSView and then change the class name and module like so


License

PlotKit is available under the MIT license. See the LICENSE file for more info.

You might also like...
๐Ÿ‘ค Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me
๐Ÿ‘ค Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me

RandomUserSwift is an easy to use Swift framework that provides the ability to generate random users and their accompanying data for your Swift applic

Swifter - A Twitter framework for iOS & OS X written in Swift
Swifter - A Twitter framework for iOS & OS X written in Swift

Getting Started Installation If you're using Xcode 6 and above, Swifter can be installed by simply dragging the Swifter Xcode project into your own pr

RxFlow is a navigation framework for iOS applications based on a Reactive Flow Coordinator pattern
RxFlow is a navigation framework for iOS applications based on a Reactive Flow Coordinator pattern

About Navigation concerns RxFlow aims to Installation The key principles How to use RxFlow Tools and dependencies GitHub Actions Frameworks Platform L

 InAppPurchase - A Simple and Lightweight framework for In App Purchase
InAppPurchase - A Simple and Lightweight framework for In App Purchase

InAppPurchase A Simple, Lightweight and Safe framework for In App Purchase Feature Simple and Light ๐Ÿ‘ Support Promoting In-App Purchases ๐Ÿ’ฐ No need t

MerchantKit - A modern In-App Purchases management framework for iOS developers

MerchantKit dramatically simplifies the work indie developers have to do in order to add premium monetizable components to their applications. Track purchased products, offer auto-renewing subscriptions, restore transactions, and much more.

SwiftyStoreKit is a lightweight In App Purchases framework for iOS, tvOS, watchOS, macOS, and Mac Catalyst โ›บ
SwiftyStoreKit is a lightweight In App Purchases framework for iOS, tvOS, watchOS, macOS, and Mac Catalyst โ›บ

SwiftyStoreKit is a lightweight In App Purchases framework for iOS, tvOS, watchOS, macOS, and Mac Catalyst. Features Super easy-to-use block-based API

An iOS Framework Capture & record ARKit videos ๐Ÿ“น, photos ๐ŸŒ„, Live Photos ๐ŸŽ‡, and GIFs ๐ŸŽ†.
An iOS Framework Capture & record ARKit videos ๐Ÿ“น, photos ๐ŸŒ„, Live Photos ๐ŸŽ‡, and GIFs ๐ŸŽ†.

An iOS Framework that enables developers to capture videos ๐Ÿ“น , photos ๐ŸŒ„ , Live Photos ๐ŸŽ‡ , and GIFs ๐ŸŽ† with ARKit content.

 ARVoxelKit - Lightweight Framework for Voxel graphic using AR + SceneKit
ARVoxelKit - Lightweight Framework for Voxel graphic using AR + SceneKit

ARVoxelKit Lightweight Framework for Voxel graphic using AR + SceneKit Requirements ARVoxelKit requires iOS 11 and devices, which support ARKit Usage

SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API.
SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API.

SpotifyLogin SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API. Usage of this framework is bound under the Developer Terms o

MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

MusicKit MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift. Examples Functional harmony let C5 = Pitch(midi: 72

Chatto is a Swift lightweight framework to build chat applications.
Chatto is a Swift lightweight framework to build chat applications.

Chatto is a Swift lightweight framework to build chat applications. It's been designed to be extensible and performant. Along with Chatto there is ChattoAdditions, a companion framework which includes cells for messages and an extensible input component. You can find more details about how it was implemented in our blog. See them in action!

Guaka - Smart and beautiful POSIX compliant CLI framework for Swift.
Guaka - Smart and beautiful POSIX compliant CLI framework for Swift.

Guaka - Smart and beautiful POSIX compliant CLI framework for Swift. It helps you create modern and familiar CLI apps in the vein of widely used proje

SwiftCLI - A powerful framework for developing CLIs in Swift

SwiftCLI A powerful framework for developing CLIs, from the simplest to the most complex, in Swift.

 SwiftShell - A Swift framework for shell scripting.
SwiftShell - A Swift framework for shell scripting.

Run shell commands | Parse command line arguments | Handle files and directories Swift 5.1 - 5.3 | Swift 4 | Swift 3 | Swift 2 SwiftShell A library fo

Futures is a cross-platform framework for simplifying asynchronous programming, written in Swift.

Futures Futures is a cross-platform framework for simplifying asynchronous programming, written in Swift. It's lightweight, fast, and easy to understa

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

A powerful and elegant Core Data framework for Swift.
A powerful and elegant Core Data framework for Swift.

A powerful and elegant Core Data framework for Swift. Usage Beta version. New docs soon... Simple do that: let query = persistentContainer.viewContext

CloudCore is a framework that manages syncing between iCloud (CloudKit) and Core Data written on native Swift.
CloudCore is a framework that manages syncing between iCloud (CloudKit) and Core Data written on native Swift.

CloudCore CloudCore is a framework that manages syncing between iCloud (CloudKit) and Core Data written on native Swift. Features Leveraging NSPersist

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Comments
  • Default axes

    Default axes

    It should be easier to create default axes. Right now this is what you need to write:

    plotView.addAxis(Axis(orientation: .Horizontal, ticks: .Fit(count: 6)))
    plotView.addAxis(Axis(orientation: .Vertical, ticks: .Fit(count: 4)))
    
    enhancement help wanted 
    opened by alejandro-isaza 0
Owner
Alejandro Isaza
Alejandro Isaza
SwiftUICharts - A charts / plotting library for SwiftUI.

A charts / plotting library for SwiftUI. Works on macOS, iOS, watchOS, and tvOS and has accessibility features built in.

Will Dale 632 Jan 3, 2023
Telegram Bot Framework written in Swift 5.1 with SwiftNIO network framework

Telegrammer is open-source framework for Telegram Bots developers. It was built on top of Apple/SwiftNIO

Pataridze Givi 279 Jan 4, 2023
CombineCoreBluetooth is a library that bridges Apple's CoreBluetooth framework and Apple's Combine framework

CombineCoreBluetooth is a library that bridges Apple's CoreBluetooth framework and Apple's Combine framework, making it possible to subscribe to perform bluetooth operations while subscribing to a publisher of the results of those operations, instead of relying on implementing delegates and manually filtering for the results you need.

Starry 74 Dec 29, 2022
Integrate Ios framework with anther framework

Puppy Paradise This project is a sample usage of my AOModalStatusView framework. When running, this application will show pictures of puppies and prov

null 0 Dec 10, 2021
A Demo using Vision Framework building on Core ML Framework

Core-ML-Sample A Demo using Core ML, Vision Framework and Swift 4. This demo is based on Inception V3 network. You must run it with Xcode 9 and iOS 11

ๆจ่ง็Ž‰ 215 Nov 9, 2022
A peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework

This repository is a peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework (which is iOS only) that lets you connect any 2 devices from any platform. This framework works with peer to peer networks like bluetooth and ad hoc wifi networks when available it also falls back onto using a wifi router when necessary. It is built on top of CFNetwork and NSNetService. It uses the newest Swift 2's features like error handling and protocol extensions.

Manav Gabhawala 93 Aug 2, 2022
Viper Framework for iOS using Swift

Write an iOS app following VIPER architecture. But in an easy way. Viper the easy way We all know Viper is cool. But we also know that it's hard to se

Ferran Abellรณ 504 Dec 31, 2022
Start your next Open-Source Swift Framework ๐Ÿ“ฆ

SwiftKit enables you to easily generate a cross platform Swift Framework from your command line. It is the best way to start your next Open-Source Swi

Sven Tiigi 821 Dec 28, 2022
Easily generate cross platform Swift framework projects from the command line

SwiftPlate Easily generate cross platform Swift framework projects from the command line. SwiftPlate will generate Xcode projects for you in seconds,

John Sundell 1.8k Dec 27, 2022
Gemini is rich scroll based animation framework for iOS, written in Swift.

Overview What is the Gemini? Gemini is rich scroll based animation framework for iOS, written in Swift. You can easily use GeminiCollectionView, which

Shohei Yokoyama 3k Dec 27, 2022