QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
QwtColorMapPreset Class Reference

Registry of named color map presets for scientific visualization. More...

#include <qwt_colormap_preset.h>

Public Types

enum  Preset {
  Viridis , Plasma , Inferno , Magma ,
  Cividis , Jet , Hot , Cool ,
  Spring , Summer , Autumn , Winter ,
  Gray , Bone , Copper , Rainbow ,
  Hsv , Turbo , CoolWarm , RdYlBu ,
  RdYlGn , Spectral
}
 Built-in colormap presets. More...
 

Static Public Member Functions

static std::unique_ptr< QwtLinearColorMapcreate (Preset preset)
 Create a QwtLinearColorMap from a preset enum.
 
static std::unique_ptr< QwtLinearColorMapcreate (const QString &name)
 Create a QwtLinearColorMap from a preset name (case-insensitive)
 
static QStringList availablePresets ()
 Get a list of all available preset names.
 
static QVector< QPair< double, QColor > > colorStops (Preset preset)
 Get the color stops for a preset (position, color pairs)
 
static QString presetName (Preset preset)
 Convert a preset enum to its string name.
 
static Preset presetFromName (const QString &name)
 Convert a string name to a preset enum (returns -1 if not found)
 

Detailed Description

Registry of named color map presets for scientific visualization.

QwtColorMapPreset provides factory methods to create QwtLinearColorMap instances from well-known colormap names used in scientific computing and data visualization (matplotlib, MATLAB, etc.).

Each preset is defined by a set of color stops at specific positions in the [0.0, 1.0] range, enabling smooth multi-stop gradient interpolation.

Example
// Use cmap->rgb(0.0, 100.0, 50.0) to get the color at the midpoint
static std::unique_ptr< QwtLinearColorMap > create(Preset preset)
Create a QwtLinearColorMap from a preset enum.
Definition qwt_colormap_preset.cpp:223
QwtLinearColorMap builds a color map from color stops.
Definition qwt_colormap.h:87
See also
QwtColorMap, QwtLinearColorMap

Member Enumeration Documentation

◆ Preset

Built-in colormap presets.

Enumerator
Viridis 

Perceptually uniform purple-green-yellow (matplotlib default)

Plasma 

Perceptually uniform purple-orange-yellow.

Inferno 

Perceptually uniform black-red-orange-yellow.

Magma 

Perceptually uniform black-purple-orange-yellow.

Cividis 

Perceptually uniform blue-gray-yellow (colorblind-friendly)

Jet 

Blue-cyan-green-yellow-red (MATLAB default)

Hot 

Black-red-yellow-white.

Cool 

Cyan-white.

Spring 

Magenta-yellow.

Summer 

Green-white.

Autumn 

Red-yellow-white.

Winter 

Blue-white.

Gray 

Black-white grayscale.

Bone 

Black-gray-white with blue tint.

Copper 

Black-copper.

Rainbow 

Red-yellow-green-cyan-blue-magenta-red.

Hsv 

Full HSV cycle.

Turbo 

Improved rainbow (Google's turbo)

CoolWarm 

Blue-white-red diverging.

RdYlBu 

Red-yellow-blue diverging.

RdYlGn 

Red-yellow-green diverging.

Spectral 

Multi-hue diverging.

Member Function Documentation

◆ availablePresets()

QStringList QwtColorMapPreset::availablePresets ( )
static

Get a list of all available preset names.

Returns
List of preset name strings

◆ colorStops()

QVector< QPair< double, QColor > > QwtColorMapPreset::colorStops ( Preset  preset)
static

Get the color stops for a preset (position, color pairs)

Get the color stops for a preset.

Parameters
presetPreset selector
Returns
Vector of (position, color) pairs

◆ create() [1/2]

std::unique_ptr< QwtLinearColorMap > QwtColorMapPreset::create ( const QString &  name)
static

Create a QwtLinearColorMap from a preset name (case-insensitive)

Parameters
namePreset name string
Returns
A QwtLinearColorMap with the preset's color stops applied

◆ create() [2/2]

std::unique_ptr< QwtLinearColorMap > QwtColorMapPreset::create ( Preset  preset)
static

Create a QwtLinearColorMap from a preset enum.

Create a QwtLinearColorMap from a preset.

Parameters
presetPreset selector
Returns
A QwtLinearColorMap with the preset's color stops applied

◆ presetFromName()

QwtColorMapPreset::Preset QwtColorMapPreset::presetFromName ( const QString &  name)
static

Convert a string name to a preset enum (returns -1 if not found)

Convert a string name to a preset enum.

Parameters
nameCase-insensitive preset name
Returns
Preset enum value, or Viridis if not found

◆ presetName()

QString QwtColorMapPreset::presetName ( Preset  preset)
static

Convert a preset enum to its string name.

Parameters
presetPreset selector
Returns
Lowercase name string

The documentation for this class was generated from the following files: