Skip to content

Qwt 7.0 New Features — A More Modern and Powerful Qt Data Visualization Library

qwt_figure

Qwt 7.0 is a modernized version based on the original Qwt 6.2.0, following the Qwt open-source license (LGPL), maintained and continuously updated by the community. This version not only brings C++11/17 standard support and a CMake build system, but also introduces a large number of practical new features, making data visualization development more convenient and efficient.

This article provides a comprehensive overview of the core new features in Qwt 7.0+, helping you quickly understand and get started with this more powerful data visualization library.

Integrated 2D/3D Plotting

Qwt Supports Both 2D and 3D

Qwt 7.0 integrates the original QwtPlot3D library, achieving unified 2D and 3D plotting support. Now a single library can satisfy both two-dimensional and three-dimensional data visualization needs.

3D Plotting Module Overview

Qwt 7.0 includes built-in complete 3D plotting capabilities, supporting:

  • Multiple Plot Types: Surface plots, mesh plots, parametric surfaces, function plots, etc.
  • OpenGL Rendering: High-performance 3D rendering with smooth interactive experience
  • Interactive Operations: Mouse rotation, zooming, and panning
  • Lighting and Materials: Realistic lighting effects and material configuration
  • Color Mapping: Automatic color mapping based on Z values, with color bar support

3D Plotting Effects

simpleplot3D

Core Classes

Class Description
Qwt3D::Plot3D 3D plot base class, providing the basic framework and interaction
Qwt3D::SurfacePlot 3D surface plot, displaying continuous surfaces (handles both grid and cell data)
Qwt3D::Function 3D function plot, generating surfaces from mathematical functions

Namespace

All 3D classes live in the Qwt3D namespace. The Qwt3DPlot3D/Qwt3DSurfacePlot/Qwt3DFunction names sometimes seen online are incorrect — the real names omit the redundant Qwt3D prefix on the class itself.

Usage Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <qwt3d_surfaceplot.h>
#include <qwt3d_function.h>

using namespace Qwt3D;

// Create a surface plot
SurfacePlot* plot = new SurfacePlot();

// Define a mathematical function
class MyFunction : public Function
{
public:
    double operator()(double x, double y) override
    {
        return std::sin(x) * std::cos(y);
    }
};

MyFunction* func = new MyFunction(*plot);
func->setDomain(-5, 5, -5, 5);  // x and y range
func->setMesh(50, 50);           // 50x50 grid
func->create();

plot->setRotation(30, 0, 45);   // Set viewing angle
plot->show();

CMake Configuration

1
2
3
4
5
6
7
find_package(qwt REQUIRED)

# Link the 2D plotting library
target_link_libraries(${PROJECT_NAME} PRIVATE qwt::plot)

# Link the 3D plotting library (optional)
target_link_libraries(${PROJECT_NAME} PRIVATE qwt::plot3d)

Advantages of Integrated 2D/3D

  • Unified Import: No need to import two separate libraries, simplifying project dependencies
  • Consistent Style: Unified 2D and 3D plotting API style, reducing the learning curve
  • Flexible Selection: Link 2D or 3D modules independently based on requirements

Complete Example

For detailed usage, refer to Introduction to 3D Plotting. Example code is located in examples/3D/simpleplot3D.

Architecture and Build Upgrades

C++11/17 Standard Support

Qwt 7.0 fully embraces modern C++ standards:

  • Qt5.12+: Uses C++11 standard
  • Qt6: Uses C++17 standard

This means you can use modern C++ features such as auto, nullptr, override, final, lambda expressions, smart pointers, etc., resulting in cleaner and safer code.

CMake Build System

Leaving behind the traditional qmake, Qwt 7.0 adopts a modern CMake build system:

1
2
3
4
5
find_package(qwt REQUIRED)
# 2D plotting
target_link_libraries(${PROJECT_NAME} PRIVATE qwt::plot)
# 3D plotting
target_link_libraries(${PROJECT_NAME} PRIVATE qwt::plot3d)

Single-File Import Method

Qwt 7.0 provides an extremely simple import method — merging the entire library into single files:

  • src-amalgamate/QwtPlot.h — Merged single header file
  • src-amalgamate/QwtPlot.cpp — Merged single source file

Simply add these two files to your project without complex build configuration, which is especially suitable for small projects or rapid prototyping.

Note

The single files are automatically generated by a tool. Do not directly edit the QwtPlot.h and QwtPlot.cpp files.

QwtFigure — Multi-Plot Layout Container

Core New Feature

QwtFigure is one of the most important new additions in Qwt 7.0, providing multi-plot layout capabilities similar to matplotlib's Figure.

Feature Overview

QwtFigure is a container window for organizing and managing multiple QwtPlot plotting components, providing:

  • Normalized Coordinate Layout: Use a [0,1] coordinate system for relative position control
  • Grid Layout: Row-column grid arrangement, following matplotlib's subplot approach
  • Parasite Axes Support: Create multiple independent axes within the same plot area
  • Graphics Export: Support for high-resolution image output

Usage Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Create a QwtFigure
QwtFigure* figure = new QwtFigure();
figure->setSizeInches(8, 6);      // Set figure size to 8x6 inches

// Add a plot using normalized coordinates
QwtPlot* plot1 = new QwtPlot();
figure->addAxes(plot1, 0.0, 0.0, 0.5, 0.5);  // Upper-left quadrant

// Add a plot using grid layout (similar to matplotlib subplot)
QwtPlot* plot2 = new QwtPlot();
figure->addGridAxes(plot2, 2, 2, 0, 1);  // 2x2 grid, row 0, column 1

Axis Alignment Feature

When multiple sub-plots have different scale ranges, tick marks may not align, affecting visual appearance. QwtFigure provides axis alignment functionality:

figure-scale-not-aligment

The addAxisAlignment function can be used to specify which sub-plot axes should be aligned:

1
figure->addAxisAlignment({ plot1, plot3, hostPlot }, QwtAxis::YLeft);

Result after alignment:

figure-scale-aligment

Interactive Operation Overlay

QwtFigureWidgetOverlay provides interactive operation capabilities on QwtFigure:

figure-widget-overlay

  • Supports mouse dragging to adjust the position and size of sub-plots
  • Supports selecting the currently active plot component
  • Provides clear visual feedback (borders, control points, size information)

Complete Example

For detailed usage, refer to QwtFigure Plot Container Window. Example code is located in examples/figure.

Parasite Axes — Multi-Axis System

Core New Feature

Parasite Axes allow creating any number of independent axes within the same plot area, perfectly solving complex multi-Y-axis and multi-X-axis plotting requirements.

How It Works

Parasite plots share the plot area with the host plot (transparent background) but have independent coordinate systems. When the host plot is destroyed, parasite plots are automatically destroyed as well, with lifecycle automatically managed.

parasite-01

Creating a Parasite Plot

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Create the host plot
QwtPlot* hostPlot = new QwtPlot();

// Create a parasite plot displayed on the YLeft axis
QwtPlot* parasitePlot = hostPlot->createParasitePlot(QwtAxis::YLeft);

// Configure the parasite plot's axes
parasitePlot->enableAxis(QwtAxis::YRight, true);
parasitePlot->setParasiteShareAxis(QwtAxis::XBottom);  // Share X axis with host

// Add a curve to the parasite plot
QwtPlotCurve* curve = new QwtPlotCurve("Parasite Curve");
curve->setSamples(...);
curve->attach(parasitePlot);

Multiple Parasite Plot Overlay

Multiple parasite plots can be created to overlay any number of axes:

parasite-plot

Complete Example

For detailed usage, refer to the Parasite Axes Guide. Example code is located in examples/parasitePlot.

Interaction Feature Overhaul

Major Improvement

Qwt 7.0 has completely overhauled interactive controls, providing a smoother user experience.

Real-Time Panning — QwtPlotPanner

The original Qwt QwtPanner used bitmap caching for panning, which meant data changes were not visible during the pan operation. Qwt 7.0 has rebuilt QwtPlotPanner based on the QwtPicker state machine to implement real-time panning:

qwt-realtime-panner

Features:

  • ✅ Full support for linear axes, logarithmic axes, and date-time axes
  • ✅ Real-time synchronized movement of multiple axes
  • ✅ Plot refreshes in real time during panning

Canvas-Wide Zooming — QwtPlotCanvasZoomer

The original QwtPlotZoomer could only bind to two axes and could not handle four-axis simultaneous zooming scenarios. Qwt 7.0 introduces QwtPlotCanvasZoomer, which requires no axis specification and automatically handles zooming for the entire canvas:

1
2
// Create a canvas-wide zoomer
QwtPlotCanvasZoomer* canvasZoomer = new QwtPlotCanvasZoomer(plot->canvas());

Class Name Changes

To maintain naming clarity, some class names have been adjusted:

Original Name New Name Description
QwtPlotZoomer QwtPlotAxisZoomer Can only bind 2 axes, renamed to axis zoomer
- QwtPlotCanvasZoomer New: canvas-wide zoomer
QwtPanner QwtCachePanner Cache-based panner
QwtPlotPanner QwtPlotCachePanner Cache-based plot panner
- QwtPlotPanner New: real-time panner

Migration Tip

Existing code requires minimal changes, as the new interfaces maintain backward compatibility. To use the original cache-based panning, use the CachePanner related classes.

Complete Example

For detailed usage, refer to the Panner Tool and Zoomer Tool.

Built-in Axis Interactive Actions

New Feature v7.0.5+

Axis interactive actions allow users to directly manipulate axes with the mouse, providing an experience similar to QCustomPlot.

Feature Demonstration

Axis Drag Operation:

qwt-scale-builtin-action-pan

  • Left-click to select an axis
  • Drag to move the axis range
  • Right-click to deselect

Axis Scroll Wheel Zoom:

qwt-scale-builtin-action-zoom

  • Left-click to select an axis
  • Scroll wheel to zoom, with zoom center at the mouse position
  • Right-click to deselect

Usage

Qwt 7 enables axis interaction by default:

1
2
3
4
5
// Enable/disable globally
plot->setEnableScaleBuildinActions(true);

// Configure individual axis behavior
plot->axisWidget(QwtAxis::XBottom)->setBuildinActions(QwtScaleWidget::ActionClickPan);

Selection Effect Customization

When an axis is selected, visual effects can be customized:

scale-selected

1
2
3
4
5
// Set selection color
plot->axisWidget(QwtAxis::YLeft)->setSelectionColor(Qt::blue);

// Increase pen width when selected
plot->axisWidget(QwtAxis::YLeft)->setSelectedPenWidthOffset(1.5);

Complete Example

For detailed usage, refer to Axis Interactive Actions.

Data Picking Feature

New Feature v7.0.6+

QwtPlotSeriesDataPicker provides powerful data picking capabilities, displaying data point information in real time as the mouse moves.

Feature Demonstration

series-data-picker

Two Picking Modes

Y-Value Picking Mode:

series-data-picker-yvalue

Displays the Y values for all curves at the current X position, with support for linear interpolation.

Nearest Point Picking Mode:

series-data-picker-nearest-value

Calculates and picks the closest point to the mouse cursor, suitable for peak data picking scenarios.

Usage Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Create a data picker
QwtPlotSeriesDataPicker* picker = new QwtPlotSeriesDataPicker(plot->canvas());

// Set picking mode
picker->setPickMode(QwtPlotSeriesDataPicker::PickYValue);

// Enable linear interpolation
picker->setInterpolationMode(QwtPlotSeriesDataPicker::LinearInterpolation);

// Customize display text
picker->setTextBackgroundBrush(QBrush(QColor(255, 255, 255, 180)));

Performance Optimization

For large datasets, Qwt 7 provides a window search algorithm:

  • Default activation threshold: 1,000 data points
  • Search window defaults to 5% of the curve point count
  • Avoids full curve traversal, significantly improving performance

Complete Example

For detailed usage, refer to Data Picking.

New Chart Types

Box Chart — QwtPlotBoxChart

New Feature v7.2.0+

QwtPlotBoxChart provides complete box-and-whisker plot support, visually presenting statistical distribution characteristics of data.

BoxChart

Features

  • ✅ Supports both pre-computed data and automatic calculation from raw data
  • ✅ Multiple whisker calculation methods: Tukey (1.5×IQR), percentile, min/max, standard deviation, standard error
  • ✅ Three box styles: rectangle, diamond, notch
  • ✅ Vertical and horizontal orientation switching
  • ✅ Automatic outlier detection, custom symbols, and jitter display

Box Chart Structure

about-boxplot

Usage Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// Create a box chart
QwtPlotBoxChart* boxChart = new QwtPlotBoxChart("Data Group A");
boxChart->attach(plot);

// Set pre-computed statistical data
QVector<QwtBoxSample> samples;
samples << QwtBoxSample(1.0, 10.0, 20.0, 35.0, 50.0, 60.0);
boxChart->setSamples(samples);

// Set style
boxChart->setBrush(QColor(100, 150, 200, 150));
boxChart->setBoxStyle(QwtPlotBoxChart::Notch);

Complete Example

For detailed usage, refer to the Box Chart Guide. Example code is located in examples/2D/boxchart.

Other Useful Features

Inward-Facing Ticks

New Feature v7.2.1+

Supports displaying axis tick marks inside the plot area, suitable for compact layout scenarios.

ticks_inside

1
2
3
// Set ticks to face inward
plot->setAxisTickDirection(QwtAxis::YLeft, QwtPlot::TickInside);
plot->setAxisTickDirection(QwtAxis::XBottom, QwtPlot::TickInside);

Complete Example

For detailed usage, refer to the Inward-Facing Ticks Guide. Example code is located in examples/2D/ticks_inside.

NaN/Inf Anomaly Value Handling

Qwt 7.0 includes improved handling of anomalous values (NaN, Inf) in data:

  • QwtPointMapper adds anomaly handling so that data anomalies do not cause coordinate mapping errors
  • Data range calculation includes anomaly value filtering
  • Plotting is more stable and will not crash due to anomalous data

QwtGridRasterData Grid Interpolation

The new QwtGridRasterData class, compared to QwtMatrixRasterData:

  • Supports 2D data table input
  • Supports X/Y axis grid interpolation
  • More flexible spectrogram data processing

Bar Chart Interface Enhancements

QwtPlotBarChart interface enhancements include:

  • Pen style settings
  • Brush (fill) style settings
  • Richer bar chart appearance customization

Migration Guide

Class Name Change Reference

Original Name New Name Migration Advice
QwtPlotZoomer QwtPlotAxisZoomer Simply replace the class name in code
QwtPanner QwtCachePanner Replace if cache-based panning is needed
QwtPlotPanner QwtPlotCachePanner Replace if cache-based panning is needed
- QwtPlotPanner New feature: real-time panning
- QwtPlotCanvasZoomer New feature: canvas-wide zooming

API Changes

  • QwtLinearColorMap::colorStop()stopPos()
  • QwtLinearColorMap adds stopColors() method

Compatibility

  • Qt5.12+ fully compatible
  • Qt6 fully supported
  • Most Qwt 6.x code can be used directly, requiring only minor class name replacements

Summary

Qwt 7.0 is a comprehensive modernization upgrade:

Category New Features
Architecture Upgrade C++11/17, CMake build, single-file import
Integrated 2D/3D QwtPlot3D integration, unified library supporting 2D and 3D plotting
Layout Features QwtFigure multi-plot container, parasite axes for multi-axis support
Interaction Improvements Real-time panning, canvas-wide zooming, built-in axis interaction
Data Picking Y-value picking, nearest-point picking, smart interpolation
Chart Types Box chart, inward-facing ticks, 3D surface/mesh plots
Stability NaN/Inf handling, anomaly value filtering

These new features make Qwt a more modern, more powerful, and more user-friendly Qt data visualization library — a single library supporting both 2D and 3D plotting — suitable for scientific computing, engineering applications, data analysis, and many other scenarios.


Get More Information