manim icon indicating copy to clipboard operation
manim copied to clipboard

PolarPlane does not work with 0 as maximum

Open cafeclimber opened this issue 3 years ago • 2 comments

Enhancement proposal

It is very common in antenna engineering to plot antenna radiation patterns in dB on a polar axis. It is also fairly common for those plots to be normalized (i.e. such that 0 is the maximum). Currently this is not possible with PolarPlane. I believe this is primarily due to these lines:

# PolarPlane.__init__()
# ...
        super().__init__(
            x_range=np.array((-radius_max, radius_max, radius_step)), # <===
            y_range=np.array((-radius_max, radius_max, radius_step)), # <===
            x_length=size,
            y_length=size,
            axis_config=self.radius_config,
            **kwargs,
        )

It should be possible to set 0 as the maximum, as well as set the minimum, eg.

class RadiationPattern(Scene):
    def construct(self):
        polar = PolarPlane(
            radius_min=-40,            
            radius_max=0,
            radius_step=10,
        )

Additional comments

This is an example of this type of plot

cafeclimber avatar Feb 25 '22 22:02 cafeclimber

It should be possible if you define your own labels in .add_coordinates([-30, -20, -10, 0], None) or similar (the second argument None is needed to use the default azimuth labels defined by azimuth_units). I could add a negate_radius argument or something if this would be a common use. I'm too busy to do it in the next couple of weeks, but I can look at it after then.

ralphieraccoon avatar Mar 13 '22 01:03 ralphieraccoon

Hi, if someone still wants me to do this, let me know and I'll start a PR.

ralphieraccoon avatar Apr 06 '22 10:04 ralphieraccoon