There are only a handful of plotting libraries in the Qt ecosystem, the mainstream ones being QCustomPlot, Qwt, Qt Charts, and KDChart.
After Qt 6.8 the former Qt Charts (2-D) and Qt DataVisualization (3-D) were merged into a unified Qt Graphs module (note: not Qt Graphics). The new back-end is built entirely on Qt Quick Scene Graph (QSG) + Qt Quick 3D, completely abandoning the aging Graphics-View / QPainter pipeline.
However, Qt Graphs must be embedded through QQuickWidget or QQuickWindow, which means the QML runtime is mandatory and C++ support is poor—complaints on the forum are numerous.
Although Qt Graphs is Qt’s official “unified” future, that future probably will not arrive within the next three years, and it drops support for older systems such as Windows 7 and is unfriendly to embedded devices.
Therefore, QCustomPlot, Qwt, Qt Charts, and KDChart will remain the practical choices for the next few years.
-
QCustomPlotis the simplest and most attractive, and enjoys the widest adoption.
Just includeqcustomplot.handqcustomplot.cppand you are ready to go (official docs).
It also supports Qt 6.
Its biggest drawback, however, is the GPL license, which is highly “viral”: any program that usesQCustomPlotmust itself be GPL—a deal-breaker for commercial use. -
Qwtis a veteran plotting library (official docs) with solid performance, yet its deployment difficulty deters many users.
It is licensed under LGPL, which is relatively commercial-friendly. -
Qt Chartsis Qt’s own plotting package (official docs) but its performance is poor—arguably very low—and unsuitable for scientific computing.
Worse, Qt Charts has no LGPL option; the open-source version is GPL v3, so using it in a project forces the entire project to be open-sourced under GPL v3. -
KDChartis KDAB’s plotting library (official docs).
Starting with KDChart 3.0 it is MIT-licensed, making it extremely commercial-friendly.
Its rendering style, however, is mediocre—reminiscent of Excel 2003.
A unique feature is Gantt charts, unavailable in the other three.
Hence, for commercial projects you are effectively limited to Qwt and KDChart 3.0.
Because the Qwt author has ceased maintenance, I personally prefer Qwt: its architecture conforms better to software-engineering principles and its large-scale rendering performance is superior.
QCustomPlot delivers out-of-the-box interactive features such as mouse zooming and axis scaling, whereas Qwt requires more code to achieve the same, yet it offers finer-grained control.
When my own projects need plotting I therefore choose Qwt, enhancing and optimizing it with the features I need—hence this project.
docment:https://czyt1988.github.io/QWT/zh/
I have taken over maintenance of the final official Qwt release, adding the features I need while gradually refining existing ones, e.g., its outdated default styling.
Project repositories:
Goals and current progress:
- CMake support
- Qt 6 support
- C++11 modernization
- Merged into single header/source for easier inclusion
- Optimize rendering for ultra-large data sets
- Provide integrated interaction helpers for simpler usage
- Modernized visual style
- Figure class for layout management
- Add parasite-axis support for unlimited axes
In short, I will keep maintaining Qwt so it becomes a license-friendly, high-performance, and easy-to-use Qt plotting library.
Qwt7.0 now supports CMake; qmake may be dropped in the future.
After installing Qwt you can simply link it in your project:
target_link_libraries(${YOUR_APP_TARGET} PUBLIC qwt::qwt)Following the example of QCustomPlot, I have merged the entire Qwt library into QwtPlot.h and QwtPlot.cpp.
Drop these two files into your project and you are ready to go.
Example CMakeLists.txt:
# QwtPlot requires Core Gui Widgets Svg Concurrent OpenGL PrintSupport
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} 5.8 COMPONENTS Core Gui Widgets Svg Concurrent OpenGL PrintSupport REQUIRED)
add_executable(YOUR_APP_TARGET
main.cpp
QwtPlot.h
QwtPlot.cpp
)
target_link_libraries(YOUR_APP_TARGET
PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::OpenGL
Qt${QT_VERSION_MAJOR}::PrintSupport
)The original Qwt style used an outdated beveled look inconsistent with modern aesthetics.
I therefore redesigned it.
Qwt 6.3:
Qwt 7.0:
Key changes: removed the default sunken style, placed axes flush against the plot area, overall appearance now aligns with contemporary design.
Similar to Python's matplotlib, Qwt provides a Figure plotting container that enables convenient layout of multiple plots.
With the newly added QwtFigure class, arranging multiple plots becomes effortless, supporting grid layouts (analogous to matplotlib's subplot).
The QwtFigureWidgetOverlay class has been configured synchronously, integrating several operations of QwtFigure—such as adjusting plot sizes and moving plots.
For details, refer to the tutorial: Figure Plotting Container
Qwt7 now supports parasite axes, allowing multiple plots to share the same axes.
For details, refer to the tutorial:Creating Multiple Coordinate Axes
Axis interaction functionality has been added, supporting drag-and-drop and mouse wheel zoom directly on the axes.
For details, refer to the tutorial:Coordinate Axis Interactive Actions
Added the QwtPlotSeriesDataPicker class to support data picking.
For details, refer to the tutorial:Series Data Picker
Refactored QwtPlotPicker to enable real-time canvas panning; the original implementation has been renamed QwtPlotCachePanner.
The new panner simultaneously supports dragging on any number of axes.
Preview:
For details, refer to the tutorial: Panning
The legacy QwtPlotZoomer requires you to specify two axes for every zoom operation.
If your plot uses four axes you must attach two zoomers—cumbersome and multi-axis-unfriendly.
The new QwtPlotCanvasZoomer needs no axis specification; it zooms the entire canvas as a whole and works seamlessly with any number of axes.
For details, refer to the tutorial: Zoomer
- Fixed the impact of
NANandINFvalues on plotting
See CHANGES.MD for detailed logs.