# Thread: XY plots with color squares -- i.e. shmoo plots

1. Novice
Join Date
Dec 2011
Posts
55
Thanks
12
Thanked 1 Time in 1 Post
Qt products
Platforms

## XY plots with color squares -- i.e. shmoo plots

What's the best way to represent XY plots with color squares, as typified by "shmoo plots"?

i.e. QColor shmoo[x][y];

where: X + Y represent the coordinates of a square, and a color per square can be assigned

These don't appear to be a native plot type -- so how much functionality can be gained by overloading current functionality?

Constraints:

- Axis numbers must be placed in-between grid lines.
- Grid lines bound each square.
- Each square may be a different color.

Examples:

image5224074054341222068.jpg

sram4.jpg

2. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,277
Thanked 871 Times in 819 Posts
Qt products
Platforms

## Re: XY plots with color squares -- i.e. shmoo plots

Originally Posted by alketi
What's the best way to represent XY plots with color squares, as typified by "shmoo plots"?
There are plot and paint device coordinates - how are your squares related to these coordinate systems ?

Uwe

3. Novice
Join Date
Dec 2011
Posts
55
Thanks
12
Thanked 1 Time in 1 Post
Qt products
Platforms

## Re: XY plots with color squares -- i.e. shmoo plots

Originally Posted by Uwe
There are plot and paint device coordinates - how are your squares related to these coordinate systems ?
So, in the attached image the relationship would be:
PLOT COORDINATES
x=10
y=2.5

DATA COORDINATES
x=0
y=0

The squares could be just a simple 2D array of color, as in:

QColor shmoo[10][10];
shmoo [0][0] = QColor("red");

But, they could also be represented in another way, if that's easier.

My requirements are
1. Create a plot that looks like the attached
2. Allow the user to click on a specific square and, in plot coordinates, re-measure that point. So, in the example below, clicking anywhere inside the lower-left point would tell me to re-measure Freq(x)=10MHz, Voltage(y)=2.5V.

What is the best way to draw color squares in Qwt that accomplishes these two goals?

Thank you for your guidance Uwe.

image5224074054341222068.jpg

4. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,277
Thanked 871 Times in 819 Posts
Qt products
Platforms

## Re: XY plots with color squares -- i.e. shmoo plots

The squares could be just a simple 2D array of color, ...
This can be done with a QwtPlotSpectrogram.

QwtMatrixRasterData in NearestNeighbur mode is close to what you want to do - see the rasterview example.

Allow the user to click on a specific square and, in plot coordinates, re-measure that point.
Using QwtPlotPicker you have the plot coordinates of each click.

Uwe

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.