You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to represent angles in a polar plot (polar histogram to be exact) with the convention of 0 degrees located at the positive y-axis and positive angles measured clockwise (placing 90 degrees at the positive x-axis).
It was mentioned in the original thread that this can be accomplished by shifting the coordinate system and relabeling the ticks. Shifting the angles is easily accomplished with the following function:
double rotateAngle(double theta) { // 90 degrees minus the angle, ensuring it's within [0, 360) double polar_theta = 90.0 - theta; if (polar_theta < 0) { polar_theta += 360.0; } return polar_theta; }
The problem I'm running into is relabeling the ticks. I attempted to make this work through use of the xticks/xlabels/rticks member functions of the axes_handle class but had no luck. The library seems to ignore the tick values and labels that I specify and instead plots with the default convention of 0 degrees aligned with the positive x-axis and positive angles measured counterclockwise.
If someone has managed to make this work with polar plot or polar histogram, could you provide an example of how you managed to change the tick labels in the plot?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This question relates to a previously posted question, which can be found here: Rotate polar plot for 0 degrees as north
I need to represent angles in a polar plot (polar histogram to be exact) with the convention of 0 degrees located at the positive y-axis and positive angles measured clockwise (placing 90 degrees at the positive x-axis).
It was mentioned in the original thread that this can be accomplished by shifting the coordinate system and relabeling the ticks. Shifting the angles is easily accomplished with the following function:
double rotateAngle(double theta) { // 90 degrees minus the angle, ensuring it's within [0, 360) double polar_theta = 90.0 - theta; if (polar_theta < 0) { polar_theta += 360.0; } return polar_theta; }
The problem I'm running into is relabeling the ticks. I attempted to make this work through use of the xticks/xlabels/rticks member functions of the axes_handle class but had no luck. The library seems to ignore the tick values and labels that I specify and instead plots with the default convention of 0 degrees aligned with the positive x-axis and positive angles measured counterclockwise.
If someone has managed to make this work with polar plot or polar histogram, could you provide an example of how you managed to change the tick labels in the plot?
Thank you for your time and consideration!
Beta Was this translation helpful? Give feedback.
All reactions