QCustomPlot Discussion and Comments

multi-colored scatter dataReturn to overview

Is there a recommended approach for displaying scatter data using multiple colors based on value, rather than all data points being colored in the same way?

As an example, imagine temperature data being displayed in blue for temperatures < X and in red > Y, where X and Y are set by the user during execution (from spin box or other control).

For special requirements like these I'd recommend subclassing QCPGraph and implementing that specific feature (in this case you'd probably have to add some properties to describe the color gradient and the associated value coordinates, and then reimplement the draw() method to do the drawing). You could of course hack this appearance into your program by adding two graphs with different coloring, and adding the points to either of the graphs depending on the value. However, this will only work for pure scatter data, not when you want to connect the points by lines.