Giter Club home page Giter Club logo

kplot's Introduction

Synopsis

kplot is an open source Cairo plotting library. This is the README file for display with GitHub, which hosts a read-only source repository of the project. To keep up to date with the current stable release of kplot, visit the kplot website.

Code Example

Interfacing with kplot is fairly easy. One creates a data source and a plot, fills the data source with points, connects the source to the plot, the plots. The data source can have its values changed, the plot can be re-plotted, etc.

log-scale

The above graph is created by the following. Note that there is little error-checking!

#include <cairo.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <kplot.h>
 
int
main(void)
{
	struct kpair	 points1[50], points2[50];
	struct kdata	*d1, *d2;
	struct kplot	*p;
	cairo_surface_t	*surf;
	size_t		 i;
	cairo_t		*cr;
 
	for (i = 0; i < 50; i++) {
		points1[i].x = points2[i].x = (i + 1) / 50.0;
		points1[i].y = log((i + 1) / 50.0);
		points2[i].y = -log((i + 1) / 50.0) + points1[0].y;
	}
	d1 = kdata_array_alloc(points1, 50);
	d2 = kdata_array_alloc(points2, 50);
	p = kplot_alloc(NULL);
	kplot_attach_data(p, d1, KPLOT_POINTS, NULL);
	kplot_attach_data(p, d2, KPLOT_LINES, NULL);
	kdata_destroy(d1);
	kdata_destroy(d2);
	surf = cairo_image_surface_create
		(CAIRO_FORMAT_ARGB32, 600, 400);
	cr = cairo_create(surf);
	cairo_surface_destroy(surf);
	kplot_draw(p, 600.0, 400.0, cr);
	cairo_surface_write_to_png
		(cairo_get_target(cr), "example0.png");
	cairo_destroy(cr);
	kplot_free(p);
	return(EXIT_SUCCESS);
}

Installation

kplot works out-of-the-box with modern UNIX systems with Cairo installations. Simply download the latest version's source archive (or download the project from GitHub), compile with make, then sudo make install or doas make install, whichever.

API Reference

See the kplot(3) manpage for complete library documentation.

License

All sources use the ISC (like OpenBSD) license. See the LICENSE.md file for details.

kplot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kplot's Issues

kplot vs siril

Hey, kristaps, long time no see !~

I've had a look at porting siril (https://siril.org/)

That piece of software uses kplot, which is how I've become aware of it.

However, they include a mutant version in their subproject/kplot directory

Someone added some getters for the plot dimension, the interface is a bit disgusting and jarring.

So, two questions:
1/ are those getters actually legitimately needed for siril ?
2a/ if so, could you update kplot to have it in a nice way with better names ?
2b/ if not, what should I change in siril to get rid of them and manage to build it with base kplot ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.