InductiveComputerScience / pbPlots

Licence: MIT license
A plotting library available in many programming languages.

Programming Languages

c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language
Visual Basic .NET
514 projects
typescript
32286 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to pbPlots

Swiftcharts
Easy to use and highly customizable charts library for iOS
Stars: ✭ 2,336 (+3190.14%)
Mutual labels:  plots, graphs
Matplotplusplus
Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
Stars: ✭ 2,433 (+3326.76%)
Mutual labels:  plots, graphs
lovelace-plotly-graph-card
Highly customisable Lovelace card to display interactive graphs. Brings scrolling, zooming, and much more!
Stars: ✭ 38 (-46.48%)
Mutual labels:  plots, graphs
SwiftCharts
Easy to use and highly customizable charts library for iOS
Stars: ✭ 2,405 (+3287.32%)
Mutual labels:  plots, graphs
hdelk
Web-based HDL diagramming tool
Stars: ✭ 51 (-28.17%)
Mutual labels:  graphs
SimplePHP
A small query builder project designed to assist daily routines and speed up the process of communicating with the database.
Stars: ✭ 14 (-80.28%)
Mutual labels:  easy-to-use
gdb graphs
To visualize function call flow for a C/C++ program using gdb and python
Stars: ✭ 61 (-14.08%)
Mutual labels:  graphs
SwiftUI-App
This swiftUI Demo is very simple & easy to understand. This swiftUI demo includes On-boarding screens, login screen, forgot password screen, sign up screen, home & logout.
Stars: ✭ 175 (+146.48%)
Mutual labels:  easy-to-use
bulk-email-sender
Send Templatized Dynamic Emails Automatically
Stars: ✭ 30 (-57.75%)
Mutual labels:  easy-to-use
angular-fusioncharts
Angular Component for FusionCharts JavaScript Charting Library
Stars: ✭ 53 (-25.35%)
Mutual labels:  graphs
vallang
Generic immutable recursive data representation API targeted at source code models and more.
Stars: ✭ 28 (-60.56%)
Mutual labels:  graphs
PySiQ
A Python Simple Queue system for your apps
Stars: ✭ 23 (-67.61%)
Mutual labels:  easy-to-use
Lassi-Android
All in 1 picker library for android.
Stars: ✭ 108 (+52.11%)
Mutual labels:  easy-to-use
umock-c
A pure C mocking library
Stars: ✭ 29 (-59.15%)
Mutual labels:  easy-to-use
py-problems-solutions
Implementations of various problems using Python. Dynamic Programming, BackTracking & Sorting algorithms 💻
Stars: ✭ 20 (-71.83%)
Mutual labels:  graphs
YetAnotherGraphPlugin
A simple plugin for creating graph-like assets for Unreal Engine 4
Stars: ✭ 30 (-57.75%)
Mutual labels:  graphs
c3
c3 HTMLWidget Ploting
Stars: ✭ 39 (-45.07%)
Mutual labels:  plots
CSSTrackr
User tracking system without javascript designed to work as a plug-and-play css file.
Stars: ✭ 13 (-81.69%)
Mutual labels:  easy-to-use
gcnn keras
Graph convolution with tf.keras
Stars: ✭ 47 (-33.8%)
Mutual labels:  graphs
PSCN
A python implementation of Patchy-San Convolutional Network for Graph
Stars: ✭ 39 (-45.07%)
Mutual labels:  graphs

pbPlots

A plotting library available in many programming languages. Goals of this library are to

  1. Have a single library for plotting that is stable accross programming languages and over time.
  2. Is easy to build in any programming language and to include in any project.
  3. Is easy to use.

The library is developed using progsbase, a technology for writing timeless code. As a consequence, it will be available in many programming languages.

bar plot

atan

regression

Download

Try the Library Online:

General User Guide

The library has the same interface in all supported languages. The example below is in Java with links to complete examples in all supported programming languages.

Basic Usage

Complete example available in the following languages:

Java | C | C++ | JavaScript | TypeScript | PHP | C# | Python | Visual Basic | Ruby

RGBABitmapImageReference imageReference = CreateRGBABitmapImageReference();
StringReference errorMessage = new StringReference();

double [] xs = {-2, -1, 0, 1, 2};
double [] ys = {2, -1, -2, -1, 2};

boolean success = DrawScatterPlot(imageReference, 600, 400, xs, ys, errorMessage);

This code produces the following graph. The boundaries are automatically calculated. The plot is linearly interpolated and drawn in black, one pixel wide.

Example 1

Customization of Plot

Complete example available in the following languages:

Java | C | C++ | JavaScript | TypeScript | PHP | C# | Python | Visual Basic | Ruby

ScatterPlotSeries series = GetDefaultScatterPlotSeriesSettings();
series.xs = new double [] {-2, -1, 0, 1, 2};
series.ys = new double [] {2, -1, -2, -1, 2};
series.linearInterpolation = true;
series.lineType = "dashed".toCharArray();
series.lineThickness = 2d;
series.color = GetGray(0.3);

ScatterPlotSettings settings = GetDefaultScatterPlotSettings();
settings.width = 600;
settings.height = 400;
settings.autoBoundaries = true;
settings.autoPadding = true;
settings.title = "x^2 - 2".toCharArray();
settings.xLabel = "X axis".toCharArray();
settings.yLabel = "Y axis".toCharArray();
settings.scatterPlotSeries = new ScatterPlotSeries [] {series};

RGBABitmapImageReference imageReference = CreateRGBABitmapImageReference();
boolean success;
StringReference errorMessage = new StringReference();
success = DrawScatterPlotFromSettings(imageReference, settings, errorMessage);

This code produces the following plot. In this plot the line is changed to dashed, 2 pixels wide, light gray. A title has been added and labels for each axis.

Example 2

Convert RGBABitmapImage to PNG

Convert to PNG and write to file:

if(success){
  double[] pngdata = ConvertToPNG(imageReference.image);
  WriteToFile(pngdata, "plot.png");
  DeleteImage(imageReference.image);
}

Line Patterns

1: "dotted", 2: "dashed", 3: "dotdash", 4: "longdash", "solid" (not shown) Line Types

Points

1: "triangles", 2: "dots", 3: "crosses", 4: "circles", 5: "filled triangles" (see blow), 6: "pixels" (see blow) Point Types 1 Point Types 2

Colors

  • CreateRGBColor(red, green, blue) - where red, green, blue are the percentages (0-1) of red, green and blue.
  • CreateRGBAColor(red, green, blue, alpha) - where alpha is the percentage of opaqueness (0-1).

Configuration Options

ScatterPlotSettings

  • width - RGBABitmapImage - The width in pixels of the image with the plot.
  • height - RGBABitmapImage - The height in pixels of the image with the plot.
  • title - String - The title on the top of the plot.
  • yLabel, xLabel - String - The labels for the y and x axis, respectively.
  • scatterPlotSeries - (See below) - The series to plot.
  • autoBoundaries - boolean - If on, automatically calculate the boundaries of the plot.
  • xMax, xMin, yMax, yMin - If autoBoundaries are off, these specify the boundaries of the plot.
  • autoPadding - If on, automatically calculate the padding.
  • xPadding, yPadding - Number of pixels - If autoPadding is off, use these paddings.
  • showGrid - boolean - If on, show the grid.
  • gridColor - RGBA - Color of the grid, if shown.

ScatterPlotSeries

  • linearInterpolation - boolean - Whether to use linear interpolation to draw the plot.
  • pointType - String - If linearInterpolation is off, the type of point. Alternatives: "crosses", "circles", "dots", "triangles", "filled triangles", "pixels"
  • lineType - String - "solid", "dotted", "dashed", "dotdash", "longdash"
  • lineThickness - Number of pixels - Thickness of line in pixels.
  • xs, ys - Array of numbers - The x and y coordinates of points in plot.
  • color - RGBA - Color of the points or line.

Multiple Plots in Same Image

RGBABitmapImageReference canvasReference1 = CreateRGBABitmapImageReference();
RGBABitmapImageReference canvasReference2 = CreateRGBABitmapImageReference();
RGBABitmapImageReference canvasReference3 = CreateRGBABitmapImageReference();
RGBABitmapImageReference canvasReference4 = CreateRGBABitmapImageReference();
RGBABitmapImage combined = CreateImage(250*2, 200*2, GetWhite());
RGBABitmapImage image1, image2, image3, image4;

double [] xs = {-2, -1, 0, 1, 2};

double [] ys1 = {2, -1, -2, -1, 2};
double [] ys2 = {-2, 1, 2, 1, -2};
double [] ys3 = {0, 1, 2, 3, 4};
double [] ys4 = {0, -1, -2, -3, -4};

boolean success;
success = DrawScatterPlot(canvasReference1, 250, 200, xs, ys1);
success = success && DrawScatterPlot(canvasReference2, 250, 200, xs, ys2);
success = success && DrawScatterPlot(canvasReference3, 250, 200, xs, ys3);
success = success && DrawScatterPlot(canvasReference4, 250, 200, xs, ys4);

if(success){
  image1 = canvasReference1.image;
  image2 = canvasReference2.image;
  image3 = canvasReference3.image;
  image4 = canvasReference4.image;

  DrawImageOnImage(combined, image1, 0, 0);
  DrawImageOnImage(combined, image2, 0, 200);
  DrawImageOnImage(combined, image3, 250, 0);
  DrawImageOnImage(combined, image4, 250, 200);
}

Multiple Plots on Same Image

Mapping from Plot Coordinates to Pixel Coordinates.

This code maps coordinates in the plot (x, y) to pixel coordinates on the image (xPixels, yPixels). This mapping is based on the automatically generated plot settings given an image image and an array of numbers xs or ys.

xPixels = MapXCoordinateAutoSettings(xPlot, image, xs);
yPixels = MapYCoordinateAutoSettings(yPlot, image, ys);

When using 'DrawScatterPlotFromSettings' use 'MapXCoordinateBasedOnSettings' and 'MapYCoordinateBasedOnSettings' instead, as it will take into account all settings when mapping the coordinate.

xPixels = MapXCoordinateBasedOnSettings(xPlot, settings);
yPixels = MapYCoordinateBasedOnSettings(yPlot, settings);

Custom Drawing on the Plot

The following code draws a line from (0, 0) to (1, 1) in the plot's coordinate system. The coordinates must be mapped to pixel coordinates before drawing. The mapping is based on the automatic settings calculated from the image dimensions and plot data.

RGBABitmapImageReference canvasReference = CreateRGBABitmapImageReference();

double [] xs = {-2, -1, 0, 1, 2};
double [] ys = {-2, 1, 2, 1, -2};

boolean success;
StringReference errorMessage = new StringReference();
success = DrawScatterPlot(canvasReference, 600, 400, xs, ys, errorMessage);

if(success){
  double x1 = MapXCoordinateAutoSettings(0, canvasReference.image, xs);
  double y1 = MapYCoordinateAutoSettings(0, canvasReference.image, ys);

  double x2 = MapXCoordinateAutoSettings(1, canvasReference.image, xs);
  double y2 = MapYCoordinateAutoSettings(1, canvasReference.image, ys);

  DrawLine(canvasReference.image, x1, y1, x2, y2, 2, GetGray(0.3));
}

This will produce the following plot.

Custom drawing on plot

Other custom drawing tools available:

  • DrawLine - Draws a line from point (x1, y1) to (x2, y2).
  • DrawPixel - Draws a pixel on point (x, y).
  • DrawRectangle1px, DrawFilledRectangle - Draws a rectangle with upper-left corner at (x, y) with a width w and heigh h.
  • DrawCircle, DrawFilledCircle - Draws a circle with center (x, y) and radius r.
  • DrawTriangle, DrawFilledTriangle - Draws an equilateral triangle with center (x, y) and distance from center to the corners h.
  • DrawText - Draws text with the upper-left point at (x, y).
  • DrawTextUpwards - Draws text upwards with the upper-left point at (x, y).
  • DrawQuadraticBezierCurve - Draws a quadratic Bézier curve from (x0, y0) to (x1, y1) with control point (cx, cy).
  • DrawCubicBezierCurve - Draws a cubic Bézier curve from (x0, y0) to (x1, y1) with control points (c0x, c0y) and (c1x, c1y).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].