QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
Public 类型 | 静态 Public 成员函数 | 所有成员列表
QwtColorMapPreset类 参考

Registry of named color map presets for scientific visualization. 更多...

#include <qwt_colormap_preset.h>

Public 类型

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 更多...
 

静态 Public 成员函数

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)
 

详细描述

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
参见
QwtColorMap, QwtLinearColorMap

成员枚举类型说明

◆ Preset

Built-in colormap presets

枚举值
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

成员函数说明

◆ availablePresets()

QStringList QwtColorMapPreset::availablePresets ( )
static

Get a list of all available preset names

返回
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

参数
presetPreset selector
返回
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)

参数
namePreset name string
返回
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

参数
presetPreset selector
返回
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

参数
nameCase-insensitive preset name
返回
Preset enum value, or Viridis if not found

◆ presetName()

QString QwtColorMapPreset::presetName ( Preset  preset)
static

Convert a preset enum to its string name

参数
presetPreset selector
返回
Lowercase name string

该类的文档由以下文件生成: