Git Product home page Git Product logo

madplotlib's Introduction

Madplotlib

A C++ wrapper of Qt Charts that looks, tastes and smells like matplotlib but isn't.

Madplotlib is a C++ header-only library that provides simple 2D plot capabilities, similar to matplotlib for Python. Madplotlib uses Qt Charts behind your back to render cool looking cats graphs that are easy to create with the help of Eigen.

Here is what it looks like:

Eigen::ArrayXf a = Eigen::ArrayXf::LinSpaced(20, 0, 2000);
Eigen::ArrayXf b = Eigen::ArrayXf::LinSpaced(20, 0, 100);
Eigen::ArrayXf c = Eigen::ArrayXf::Zero(20);

b = b * b;
c = 1000;

Madplotlib plt;
plt.title("Test 5: Linear vs Exponential vs Flat");
plt.ylabel("Y Values");
plt.xlabel("X Values");

plt.plot(a, QString("label=Linear"));
plt.plot(b, QString("label=Exponential"));
plt.plot(c, QString("label=Flat"));
plt.legend("loc=center right");
plt.show();

Screenshots

Installation

Make sure to use Qt 5.7 or higher and that you have Eigen 3.x properly installed. After that, just add Madplotlib.h to your projects and don't worry about anything else. We got your back, Jack!

Testing

The companion cube file eigen_tests.cpp demonstrates several features offered by this library. Each test case is heavily commentted to make sure you know what it is doing and how. They are a great reference to get you quickly started. By the way, did I mention it resembles matplotlib? Did I?!?

Contribute

There's a ginormous number of things I would like to incorporate into this library, including a damn good documentation. ;) If you are strong with the Force and would like to contribute to this project, I recommend this hands-on guide to Github-Forking to learn the technical shenanigans. Remember: when in doubt, do not clone... fork!

Contact

Twitter

Stackoverflow

Library features

  • Data for plotting must be created through Eigen::ArrayXf;
  • Draw lines, scatter plots, or both, simultaneously and at the same time:
    • Lines can be continuous, made of dashes or even dots;
    • Circular or squared markers can be used on scatter plots;
  • It supports multiple series of data;
  • Title, labels, legends and more can be specified;
  • Color support for lines and markers;
  • Persistence: save your charts on the disk (PNG/JPG);
  • Define limits for your axis;
  • Show/hide axis ticks or background grid;
  • Charts block execution flow when they are show() to mimic plot() from matplotlib (but this can be disabled);

madplotlib's People

Contributors

karlphillip avatar dtmoodie avatar madplotlib avatar

Watchers

James Cloos 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.