vis.plot() plots with incorrect circle radius
robert-30 opened this issue · 5 comments
Hi, when I plot a circle with radius 1
import phi.geom as geom
import phi.vis as vis
vis.plot(geom.Sphere(math.tensor([[0, 0]], math.instance(points=None), math.channel(vector='x,y')), math.tensor([1], math.instance(points=None))))
The result is a circle with radius \sqrt{2}/2:
It seems that this is caused by the fact that the radius is converted to the diameter by multiplication with sqrt(2), instead of by multiplication with 2. Replacing 1.41 with 2.0 gives a circle of the expected size:
Are you using Plotly for the plots? Unfortunately, the effective size must be specified in pixels and does not scale with the axes. If you zoom in, the sizes will change. I havn't found a good way to fix that.
No, I'm using matplotlib
Interesting, when I run the same snippet, I get the correct radius. Maybe they changed how the pixel size behaves across versions? I'm using matplotlib 3.5.2.
The matplotlib version doesn't seem to affect the result but running inside a notebook gives different results from opening a window for the figure. Displaying the result inside PyCharm gives different results yet again. Maybe the DPI is affecting it or the figure size somehow changes across displays...