RE: Scatter plots + axis/plot scaling
Brought to you by:
rathmann
|
From: <Edw...@gt...> - 2010-01-19 22:24:02
|
David et al., We are now implementing a class similar to yours and have a question about the specifics of your implementation: do your (pixel) min/max dot sizes depend on the size of the QwtPlot canvas? If so, can you explain how you've worked things so that the markers are sized properly after the initial layout? If you're not scaling based on canvas size, any ideas on how I can at least delay QwtPlot rendering/construction until after the Qt layout engine is finished? My problem now is that when I create my QwtPlotMarkers, the GUI layout hasn't finished, and the QwtPlot canvas returns an artificially small size (like 30x30 pixels), which makes every the largest markers tiny. Hardcoding a max dot size isn't satisfactory because I want the plots to look reasonable both at full-screen, large monitor sizes (1920x1200+) and at relatively tiny sizes (arrays of many 100x100 plots): a small max will lose far too much scaling info at the large size and introduce too much whitespace for presentation-type uses; a large max has obvious problems for tiny plots. Thus, the best workaround that I can think of is to set a marker size in pixels based on the canvas size, but only after the layout engine is finished as I mentioned above. Other ideas, anyone? Thanks, Ed > -----Original Message----- > From: David Stranz [mailto:Dav...@Ma...] > Sent: Monday, January 04, 2010 10:31 PM > To: List for both Qwt users and developers > Subject: Re: Scatter plots + axis/plot scaling > > Ed, > > > + QwtSymbols are in screen pixel sizes. Since I want marker size to > > indicate a data value, I need to size them according to axis > > values/coordinates (and therefore resize when the graph resizes). > > What would be the easiest approach? Since the screen pixel size is > > dynamic and dependent on both the window size and the underlying > > data, I didn't think subclassing QwtSymbol or QwtPlotMarker would be > > right... subclass QwtPlot and reimplement drawItems()? > > (Excuse any technical errors, because I'm writing this from memory > without the code to reference as I write). > > I do almost exactly what you are asking, with the exception of an > inverted y-axis. I derived my own QwtPlotItem (which I call DotItems) > and overrode the draw method to color and/or scale the dots according > to > a third dimension of data value. My plot item class defines a minimum > and maximum dot size in pixels and a minimum and maximum data value > range; each dot size in pixels is interpolated as the fraction of the > world range represented by that particular dot's value. > > I don't know your application, but you will probably find that scaling > the dot size according to the zoom level doesn't work well at all. In > principle, you could zoom in to the point where all you see is a big > splot. I found that keeping the dot size fixed (but proportional to > data value) no matter what the x- and y-axis scales looked much better > than trying to scale everything to the zoom level. Additionally, the > z-value really has no relationship to the x- and y data ranges anyway, > so what does zooming x- and y-axes mean in terms of an unrelated z- > value? > > From a user's point of view, if you have two very closely spaced dots, > what you would hope to see on zooming in is to resolve the overlapping > dots into two distinct dots. If you scaled the dot size to the zoom > level, you would never be able to resolve them - they'd each just get > bigger and still be overlapped. > > David > _______________________________________________________________ > David Stranz, Ph.D. dav...@Ma... > > Sierra Analytics, Inc. > 5815 Stoddard Road, Suite 601 > Modesto, CA 95356 > > Tel: (209) 545-8508 > http://www.massspec.com > _______________________________________________________________ > > > > Edw...@gt... wrote: > > I'm putting together a 2D plotting component for some specialized > > software and am hitting a few snags using Qwt to do it, and I hope > > someone might be able to give me some pointers. > > > > My first job is a simple scatter plot with that 1) scales the size of > > each marker in accordance with a data variable and 2) colors each > > marker in accordance with a data variable/color mapping. The graph > > has all its data from the beginning (i.e., no real-time), but does > > need to redraw gracefully as the parent window resizes--the plot > > canvas should have the smallest bounding rect that contains all plot > > items (and not have scrollbars). > > > > My questions, so far: > > > > + I see a scatter plot PNG off the home page; is there example source > > for it that I'm missing? > > > > + My interpretation of the QwtPlot documentation is that > > setAxisAutoScale (which is on by default) would set up the axes and > > the canvas view so that all of my plot items are visible by default. > > However, I haven't been able to get that to happen without manually > > calling setAxisScale(). Is my understanding incorrect, or am I > > missing something? > > > > + Along similar lines, when I call setAxisScale() I expected that > > this would turn off autoScaling (since I'm specifying a fixed scale). > > But when I resize my window, the QwtPlot area draws more axis space. > > Am I misunderstanding what autoScaling means (or that setting one > > manually indeed turns it off)? > > > > + QwtSymbols are in screen pixel sizes. Since I want marker size to > > indicate a data value, I need to size them according to axis > > values/coordinates (and therefore resize when the graph resizes). > > What would be the easiest approach? Since the screen pixel size is > > dynamic and dependent on both the window size and the underlying > > data, I didn't think subclassing QwtSymbol or QwtPlotMarker would be > > right... subclass QwtPlot and reimplement drawItems()? > > > > + What exactly is the intended purpose of QwtScaleEngine::Inverted? > > For various reasons, I need to draw the y-axis so that positive is > > down; I thought this option might be exactly what I was looking for, > > but it doesn't seem to do anything for me. > > > > I haven't included any code for brevity, but if it proves useful I > > can insert my usage. Thanks, > > > > Ed > > > > --------------------------------------------------------------------- > --------- > > This SF.Net email is sponsored by the Verizon Developer Community > > Take advantage of Verizon's best-in-class app development support A > > streamlined, 14 day to market process makes app distribution fast and > > easy Join now and get one step closer to millions of Verizon > > customers http://p.sf.net/sfu/verizon-dev2dev > > _______________________________________________ qwt-interest mailing > > list qwt...@li... > > https://lists.sourceforge.net/lists/listinfo/qwt-interest > > > > > > > > > ----------------------------------------------------------------------- > ------- > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest |