PDA

View Full Version : XY plots with color squares -- i.e. shmoo plots



alketi
7th April 2013, 00:39
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:

8891

8892

Uwe
7th April 2013, 09:55
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

alketi
7th April 2013, 17:41
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. :)

8894

Uwe
8th April 2013, 07:06
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