Re: aligning multiple charts and y-labels using scientific notations
Paul <paulanon <at> gmail.com>
2012-04-03 01:57:32 GMT
Thanks David, I will check that out.
I think I'm also interested in showing scientific notations, just
because. Is there a flag that I can set, or is it more involved than
that.
Thanks.
On Mon, Apr 2, 2012 at 1:17 PM, David Stranz <David_Stranz <at> massspec.com> wrote:
> Paul,
>
> > PS. btw, good guess David :)
>
> LOL. And doing proteomics, too.
>
> In Qwt 5.2, there was a "plotmatrix" example which I don't see (yet) in
> the Qwt 6 release. However, the guts of the code give the method for
> aligning the y axes of multiple stacked QwtPlots. The plotmatrix
> example assumes a grid of numRows x numCols plots:
>
> void PlotMatrix::alignVAxes(int col, int axis)
> {
> if ( axis != QwtPlot::yLeft && axis != QwtPlot::yRight )
> return;
>
> int maxExtent = 0;
> for ( int row = 0; row < numRows(); row++ )
> {
> QwtPlot *p = plot(row, col);
> if ( p )
> {
> QwtScaleWidget *scaleWidget = p->axisWidget(axis);
>
> QwtScaleDraw *sd = scaleWidget->scaleDraw();
> sd->setMinimumExtent(0);
>
> const int extent = sd->extent(
> QPen(Qt::black, scaleWidget->penWidth()),
> scaleWidget->font() );
> if ( extent > maxExtent )
> maxExtent = extent;
> }
> }
> for ( int row = 0; row < numRows(); row++ )
> {
> QwtPlot *p = plot(row, col);
> if ( p )
> {
> QwtScaleWidget *scaleWidget = p->axisWidget(axis);
> scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
> }
> }
> }
>
> I think you can figure out from this what needs to be done in your case.
>
> Cheers,
>
> David
> _______________________________________________________________
> David Stranz, Ph.D. david_stranz <at> MassSpec.com
>
> Sierra Analytics, Inc.
> 5815 Stoddard Road, Suite 601
> Modesto, CA 95356
>
> Tel: (209) 545-8508
> http://www.massspec.com
> _______________________________________________________________
>
>
> On 4/2/2012 1:00 PM, Paul wrote:
>> Hi there,
>>
>> I have four plots stacked vertically with the same x-range (with
>> different y-range). I'm trying to make sure that the user sees them
>> perfectly aligned in the screen space. That is, if the four plots
>> show the same point in x-position, they can place a physical ruler
>> vertically on the screen and see them aligned. However, this does not
>> happen because the y-axis is not aligned, as seen on this image:
>>
>> http://imgur.com/1lFQe
>>
>> I'm wondering how to fix this. The culprit seems to be the y-label
>> string length.
>> Solution 1) I actually want to use use scientific notation for the
>> y-range, which in turn will implicitly align the y-axis of the four
>> plots as they would have the same string length. Solution 2) Maybe
>> there's a more direct way to control the position of the y-axis in
>> screen space?
>>
>> Thanks in advance,
>> Paul
>>
>> PS. btw, good guess David :)
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> qwt-interest mailing list
>> qwt-interest <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qwt-interest
>>
>>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> qwt-interest mailing list
> qwt-interest <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qwt-interest
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev