Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making plot in Qt

I need to implement some plot like that or that in my app , it can be even something similar.

I made a search on Qt web site with no progress , and I saw Qwt package but nothing similar there.

Any ideas?

like image 380
Night Walker Avatar asked Sep 29 '09 08:09

Night Walker


People also ask

What is QCustomPlot?

QCustomPlot is a Qt C++ widget for plotting and data visualization. It has no further dependencies and is well documented. This plotting library focuses on making good looking, publication quality 2D plots, graphs and charts, as well as offering high performance for realtime visualization applications.

What is Qtwidgets?

Widgets are the primary elements for creating user interfaces in Qt. Widgets can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a parent widget is called a window.

What is Qt in C++?

Qt is the complete software development framework. The Qt framework contains a comprehensive set of highly intuitive and modularized C++ library classes and is loaded with APIs to simplify your application development.


7 Answers

I love QCustomPlot which is a Qt C++ library. It focuses on making good looking, publication quality 2D plots, graphs and charts and also has high performance for real-time visualization applications. You can get it here: http://www.qcustomplot.com/

like image 142
Nejat Avatar answered Oct 02 '22 05:10

Nejat


I strongly recommend Qwt.

Qwt is a mature, well-documented library and, I think it's fair to say, the standard solution for implementing plots and other display and control widgets in Qt.

If you need 3D plots, try QwtPlot3D.

like image 25
Sam Dutton Avatar answered Oct 02 '22 03:10

Sam Dutton


I'm using Qwt for that. The trick is to use a step function (see last example by this link), and shift the data by 0.5, so that bars will be centered to ticks. Here is an example of what you can get with alpha blending and anti-aliasing enabled: my histogram. Hope, you will do even better ;-)

like image 31
MadH Avatar answered Oct 02 '22 05:10

MadH


As an alternative to Qwt you might also consider qt-plotting-widget which may be a simpler option.

like image 32
poleguy Avatar answered Oct 02 '22 03:10

poleguy


Qt 5.6 now includes Qt Charts 2.1, which supports bar charts (as well as 7 other kinds).

like image 31
Attila Tanyi Avatar answered Oct 02 '22 05:10

Attila Tanyi


Qt has no support for plotting out of the box.

The most basic solution is to use QGraphicsView. Simply render your plot using the various items.

Other than that, you can follow this thread. It contains a couple of pointer to plotting frameworks but I don't know how useful they are or whether they are still supported in Qt 4.x.

like image 44
Aaron Digulla Avatar answered Oct 02 '22 05:10

Aaron Digulla


QCustomPlot is really easy to get started and there is plenty of Cartesian plot types you can do. Having said that, performance-wise it is not as good as other people say if you intend to plot large time series all at once. It internally uses a QMap to store the data which means that for every data point you insert or remove when populating, there is going to be one allocation / release of memory to add the data point to the map. See this post for more information.

Another thing I don't like is that even for simple plots it uses internally a struct QCPData that stores 6 double values when you would normally need two (x and y). That is, it triples the amount of memory you need to display a time series.

like image 45
Darien Pardinas Avatar answered Oct 02 '22 03:10

Darien Pardinas