As the picture shown, the axes don't fit with the plot well.
Why?And how to fix it?
(The axes are not the ones in QwtPlot.)
why.jpg
As the picture shown, the axes don't fit with the plot well.
Why?And how to fix it?
(The axes are not the ones in QwtPlot.)
why.jpg
Uwe,
i have found a thread about the similar prob posted several years ago.
it seems two or three lines of codes work.
but it is on the earlier release of qwt.
can you tell me how to do on 6.1?
And what is it what you want to do: maybe "plot->enableAxis( QwtPlot::xTop );" ?
Uwe
Uwe,
i just want to know how to achieve the effect mentioned in the following thread with qwt6.1 :
http://www.qtcentre.org/threads/1836...ut-of-the-plot
thanks in advance.
This thread is about a scrollview - and the idea posted there the same for Qwt 6.1. Does this answer help: no.
So better answer my question and explain your situation.
Uwe
Uwe,
I have the similar situation mentioned in that thread.
In that thread you provided codes like this:
1.void XXX::syncScale(int axis)
2.{
3. ...
4.
5. yourScale->setScaleDiv(
6. plot->axisScaleEngine(axis)->transformation(),
7. plot->axisWidget(axis)->scaleDiv() );
8.
9. int startDist, endDist;
10. yourScale->getBorderDistHint(startDist, endDist);
11. yourScale->setBorderDist(startDist, endDist);
12.
13.}
14.
15.connect(plot->axisWidget(...), SIGNAL(scaleDivChanged(),
16. ..., SLOT(syncScale() );
but I don't find a function which is like the following one in the class QwtScaleWidget
yourScale->setScaleDiv( plot->axisScaleEngine(axis)->transformation(), plot->axisWidget(axis)->scaleDiv() );What I've found is setScaleDiv( const QwtScaleDiv &sd ) and setTransformation( QwtTransform * ).
So I am confused.
What I have tried is like this:
initPlot()
{
myplot = new QwtPlot();}
myplot -> enableAxis( QwtPlot::yLeft, false );
myplot -> enableAxis( QwtPlot::xBottom, false );
myplot -> setAxisAutoScale( QwtPlot::yLeft, false );
myplot -> setAxisAutoScale( QwtPlot::xBottom, false );
//some plot items initialization
...
updateAxes();
updateAxes()
{
//for each axis of the four, I try to set the same transformation and scalediv for left and right axes or top and bottom axes}
scaleWidget[Left] -> setTransformation( myplot -> axisScaleEngine( QwtPlot::yLeft ) -> transformation() );
scaleWidget[Right] -> setTransformation( myplot -> axisScaleEngine( QwtPlot::yLeft ) -> transformation() );
scaleWidget[Left] -> setScaleDiv( myplot -> axisScaleDiv( QwtPlot::yLeft ) );
scaleWidget[Right] -> setScaleDiv( myplot -> axisScaleDiv( QwtPlot::yLeft ) );
int startDist, endDist;
scaleWidget[Left] -> getBorderDistHint( startDist, endDist );
scaleWidget[Left] -> setBorderDist( startDist, endDist );
scaleWidget[Right] -> setBorderDist( startDist, endDist );
//the similar codes for scaleWidget[Top] and scaleWidget[Bottom]
//...
but when the plot is shown, it looks like the picture I've attached in this thread before.
and the ticks are not aligned with the contents of the plot.
Your fan,
Nicho
Last edited by Nicho; 22nd June 2013 at 05:47. Reason: updated contents
Uwe,help,please
What do you want to do ( not how ) ?
Uwe
Uwe,
In my application, I want to create several scatter plots which are placed in grid.
The plots in the same row have the same Y axis and the ones in the same column have the same X axis.
The plots need to be placed one by one without axes between them.
Maybe I could choose this way: enable the plots in the first row to show their X-Top axis, the ones in the last row to show their X-Bottom axis, and the ones in the far left column to show their Y-Left axis, and so on.
But in my application, all the plots better to be displayed as the same size.
Because of this, I disabled the axes included in QwtPlot.
Now my application is running like this ( the ticks are not aligned with the plot contents ):
prob.jpg
Uwe,
How to align the ticks to the plot contents?
Could you provide me sth. in details?
I think my prob is similar with that thread, because it's also about how to align the ticks of the axis outside of the plot to the contents of the plot.
But I tried many many times including that, and failed.
Looking forward to your advice eagerly.
Thanks in advance.
Nicho
Last edited by Nicho; 24th June 2013 at 11:25. Reason: updated contents
See below qwt-6.1/playground/plotmatrix/
Uwe
Uwe,
Thank you soooooo much.
I have read all the examples to seek sth. helpful to my prob time and time again and failed to find one.
Unblievable, I missed the playground.
It is what I need, and I'll try to show X axes based on the idea of plotmatrix.
At the same time, I wish with my heart that Uwe could fix the example for x axis soon if you can share me some time.
For I am not sure I will succeed in doing that, but I'll try.
Thanks again.
Uwe,
I have played around with the example plotmatrix.
And for example here:
52 int main( int argc, char **argv )
53 {
54 QApplication a( argc, argv );
55
56 MainWindow mainWindow;
57
58 mainWindow.resize( 800, 600 );
59 mainWindow.show();
60//I added the following codes
61 QwtPlot *p = (mainWindow.plot( 3, 0 ));
62 QwtScaleWidget *sc = p -> axisWidget( QwtPlot::yLeft );
63 sc -> setLabelRotation( 45 );
64
65 return a.exec();
66 }
When I rotated the yLeft axis label of the plot[3][0] , only the left axis is aligned with the plot[3][0].
The other plots in Row 3 are not right.
And the matrix shows like this :
prob-1.jpg
How to fix this?
Thank you in advance.
Uwe,
Can you help me?
I could not make the axes align with the plots well based on the plotmatrix.
I followed to add the control on x axis as what you have done on the y axis.
But the top axis is synchronized as the bottom one, but the top axis is not aligned with the plot.
It seems the top plots' grid are not synchronized with the axis.
How could I do? Need your help.
Many many thanks.
Seeing this pic below:
prob-2.jpg
Bookmarks