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

## 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?

Regards

2. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,241
Thanked 860 Times in 809 Posts
Qt products
Platforms

## Re: QwtPolarPlot questions

Originally Posted by Galabis
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.

Originally Posted by Galabis
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. Beginner
Join Date
Jun 2012
Posts
3
Thanks
1
Thanked 1 Time in 1 Post
Qt products
Platforms

## 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:
`class MyTransformation: public QwtScaleTransformation {public:  MyTransformation(Type type) : QwtScaleTransformation(type)  {};  virtual double xForm(double x, double s1, double s2, double p1, double p2) const {    if (type() == Log10) {      return p1 + (p2 - p1) / log(s2 / s1) * log(x / s1);    }    else {      if (x < s1) {        x = 18100;      }      return p1 + (p2 - p1) / (s2 - s1) * (x - s1);    }  }  virtual QwtScaleTransformation* copy() const {    return new MyTransformation(QwtScaleTransformation::Linear);  }};  class MyScaleEngine: public QwtLinearScaleEngine {  virtual QwtScaleTransformation* transformation() const {    return new MyTransformation(QwtScaleTransformation::Linear);  }}; 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. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,241
Thanked 860 Times in 809 Posts
Qt products
Platforms

## 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:
`virtual double xForm(double x, double s1, double s2, double p1, double p2) const{    const double sd = ...;    const double pd = p1 + 0.1 * ( p2 - p1 ); // 10% of the radius for the inactive part     if ( x <= sd )        return p1 + (pd - p1) / (sd - s1) * (x - s1);     else        return pd + (p2 - pd) / (s2 - sd) * (x - sd); }`
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. Beginner
Join Date
Jun 2012
Posts
3
Thanks
1
Thanked 1 Time in 1 Post
Qt products
Platforms

## Re: QwtPolarPlot questions

It works for me. Thanks a lot!

#### 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.