Results 1 to 5 of 5

Thread: QwtPolarPlot questions

  1. #1
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPolarPlot questions

    Hi!

    I would be grateful if you could help me with QwtPolarPlot.

    1. I need a plot, where points with minimum radius would be placed not at center, but on some circle. I mean, that there must be inactive area at the center so the radial axis starts at some distance from pole.

    2. The second problem appears, when I change radial scale. All points with radius, that is less than new radial scale minimum, are painted at the center of the plot, but I want them not to be painted exactly. How can I avoid this effect?

    Thanks in advance
    Regards
    Attached Images Attached Images
    • File Type: jpg 1.jpg (50.0 KB, 21 views)
    • File Type: jpg 2.jpg (45.9 KB, 14 views)

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPolarPlot questions

    Quote Originally Posted by Galabis View Post
    1. I need a plot, where points with minimum radius would be placed not at center, but on some circle. I mean, that there must be inactive area at the center so the radial axis starts at some distance from pole.
    On your first screenshot I can see a scale with the first tick at 4000 - nothing special.

    Quote Originally Posted by Galabis View Post
    2. The second problem appears, when I change radial scale. All points with radius, that is less than new radial scale minimum, are painted at the center of the plot, but I want them not to be painted exactly. How can I avoid this effect?
    Looks like you want to have a transformation that is different for values >= "minimum" and values between 0->minimum. Check QwtScaleEngine::transformation().

    Uwe

  3. #3
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPolarPlot questions

    On your first screenshot I can see a scale with the first tick at 4000 - nothing special.
    Actual minimum of radial scale on the picture is 2000. I can fit good minimum to have the same picture with limits 2000-18000, but the problem is that I need to change scale limits often, so the ticks appear in inactive area. I want the radius of inactive area to be adjustable, for example about 1/5 of the full plot radius, and to have a minimum tick at the border of this area independently of its radius.

    Looks like you want to have a transformation that is different for values >= "minimum" and values between 0->minimum. Check QwtScaleEngine::transformation().
    I looked at QwtScaleEngine::transformation() and made a suggestion, that you mean method QwtScaleTransformation::xForm(), which returns negative value in my case. I wrote the code, but it had no effect. Where am I wrong?

    Qt Code:
    1. class MyTransformation: public QwtScaleTransformation {
    2. public:
    3. MyTransformation(Type type) : QwtScaleTransformation(type) {};
    4. virtual double xForm(double x, double s1, double s2, double p1, double p2) const {
    5. if (type() == Log10) {
    6. return p1 + (p2 - p1) / log(s2 / s1) * log(x / s1);
    7. }
    8. else {
    9. if (x < s1) {
    10. x = 18100;
    11. }
    12. return p1 + (p2 - p1) / (s2 - s1) * (x - s1);
    13. }
    14. }
    15. virtual QwtScaleTransformation* copy() const {
    16. return new MyTransformation(QwtScaleTransformation::Linear);
    17. }
    18. };
    19.  
    20.  
    21. class MyScaleEngine: public QwtLinearScaleEngine {
    22. virtual QwtScaleTransformation* transformation() const {
    23. return new MyTransformation(QwtScaleTransformation::Linear);
    24. }
    25. };
    26.  
    27. setScaleEngine(QwtPolar::ScaleRadius, new MyScaleEngine);
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to Galabis for this useful post:

    Uwe Yashwanth (6th July 2018)

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPolarPlot questions

    You need to devide p1-p2 into 2 intervals. Then map all values below your minimum ( sd ) linear into the first interval , all others in the second.

    Something like this:

    Qt Code:
    1. virtual double xForm(double x, double s1, double s2, double p1, double p2) const
    2. {
    3. const double sd = ...;
    4. const double pd = p1 + 0.1 * ( p2 - p1 ); // 10% of the radius for the inactive part
    5.  
    6. if ( x <= sd )
    7. return p1 + (pd - p1) / (sd - s1) * (x - s1);
    8. else
    9. return pd + (p2 - pd) / (s2 - sd) * (x - sd);
    10. }
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe

  6. The following user says thank you to Uwe for this useful post:

    Galabis (28th June 2012)

  7. #5
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPolarPlot questions

    It works for me. Thanks a lot!

Similar Threads

  1. Animating a QwtPolarPlot
    By bwnicewo in forum Qwt
    Replies: 5
    Last Post: 14th June 2012, 15:38
  2. Animating a QwtPolarPlot
    By bwnicewo in forum Qt Programming
    Replies: 0
    Last Post: 8th June 2012, 17:54
  3. QwtPolarPlot radius scale
    By brutus35 in forum Qwt
    Replies: 2
    Last Post: 24th February 2011, 17:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.