Giter Site home page Giter Site logo

matplotpp's Introduction

MatPlotPP

This repository is a fork of the matplotpp library by Yuichi Katori.

logo

Welcome

MATPLOT++ is a Matlab like simple plotting framework in C++. In cases where you need to make plots of data generated in C/C++, matplotpp enables you to generate 2D/3D plots, histograms, scatterplots, etc, just by adding a few lines of code, without any external plotting tool such as MATLAB or Gnuplot.

MATPLOT++ features are the following:

  • MATLAB like command set.
  • Cross platform compatibility on Linux, MacOS, and Windows. matplotpp is based on OpenGL/GLUT which is a simple cross-platform windowing API.
  • High quality vector output: PS, EPS, PDF, and SVG.

You can generate 2D/3D plots, histograms, scatterplots, etc, by adding just few lines of code in C++ as following.

logo

Minimal Example

Following screenshot and code are a minimal example that provide just a sinusoidal curve. logo

#include "matplotpp.h"

using namespace MatPlotPP;
class MP : public MatPlot<double> { 
void DISPLAY() {
    vector<double> x(100), y(100);    
    for(int i=0; i<100; ++i){
        x[i] = 0.1*i;
        y[i] = sin(x[i]);
    }
    plot(x, y);
}
};

MP mp;
void display() { mp.display(); }
void reshape(int w, int h) { mp.reshape(w, h); }

int main(int argc, char* argv[]) {
    glutInit(&argc, argv);
    glutCreateWindow(100, 100, 400, 300);
    glutDisplayFunc( display );
    glutReshapeFunc( reshape );
    glutMainLoop();    
    return 0;
}

The core of this code is on DISPLAY function (from line 4 to 11), which is a member function of class MP that is publicly derived from the MatPlot class. In this function, plot() conducts on plotting the sinusoidal function. In the main() function, functions prefixed by glut are about initialization of graphic environment. MATPLOT++ users are not required to know about OpenGL or GLUT. Just remember these functions are necessary for initialization of graphic environment.

Compilation

git clone https://github.com/pemryan/MatPlotPP.git

MSVC project files come with code.

matplotpp's People

Contributors

pemryan avatar

Watchers

 avatar  avatar

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.