How to plot filled polygons in QwtPlot
Hi,
I'm looking for an example that will help me plot filled polygons from a Voronoi diagram in a QwtPlot chart widget.
http://en.wikipedia.org/wiki/Voronoi_diagram
I can currently generate the Voronoi diagrams, extract closed polygons for each Voronoi cell, and post the polylines in QwtPlot. I can also add RGB color attributes to these cells; however, I'd like to take this one step further by plotting each filled polygon in a QwtPolt widget by the colors I've generated.
Any help is appreciated.
Re: How to plot filled polygons in QwtPlot
Use Qwt 6.1 where you find QwtPlotShapeItem - or implement a new type of plot item for the complete diagram ( thought about having a Voronoi diagram plot item in Qwt myself ).
By the way: what algorithm do you use for distributing colors to the cells ?
Uwe
Re: How to plot filled polygons in QwtPlot
Thanks Uwe. I'm still on 6.0.2.
I'm using the Voronoi algo in the Boost Polygon library, but not colorizing randomly. In our case, colors need to be assigned to each cell based on various site [control point] attributes, so just comparing site attribute values to a predefined RGB colormap, and using linear interpolation to get color for each site.
Thanks again for the tip. Let me upgrade to 6.1 and play with it.
Re: How to plot filled polygons in QwtPlot
Uwe, I got the QwtPlotShapeItem class to work in our Voronoi tool.
The itemEditor example application you provided in the 6.1rc3 release was very helpful.
BTW - I just discovered your ColorMap classes, and they appear to have everything I need. I can't believe I never noticed them ...
Thank you.