sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

Polar plot with short axis has overlapping labels #11978

Open kcrisman opened 13 years ago

kcrisman commented 13 years ago

In 4.7.1:

sage: polar_plot(1/sin(1.001*theta),(theta, pi/12,pi/2))

Downloads/sage-4.7.1/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
    443             filename_or_obj = file(filename_or_obj, 'wb')
    444         _png.write_png(renderer._renderer.buffer_rgba(0, 0),
    445                        renderer.width, renderer.height,
--> 446                        filename_or_obj, self.figure.dpi)
    447         renderer.dpi = original_dpi

RuntimeError: Error building image

but this works

sage: polar_plot(1/sin(1.01*theta),(theta, pi/12,pi/2))

though it looks terrible, see attached pictures.

This no longer causes an error in 4.7.2, but the picture is still terrible.

Hat tip to Bill Page at this ask.sagemath.org question for noticing the error.

CC: @jasongrout

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/11978

kcrisman commented 13 years ago

Attachment: tinyaxispolarplot.png

Attachment: tinyaxispolarplot2.png

kcrisman commented 13 years ago
comment:1

My guess is the automatic aspect ratio 1 is the problem, but that's just a guess.

jasongrout commented 13 years ago
comment:2

For polar plots, it makes sense a lot of times to have aspect_ratio=1. You want circles to look like circles, roses to look like roses, etc.

kcrisman commented 13 years ago
comment:3

For polar plots, it makes sense a lot of times to have aspect_ratio=1. You want circles to look like circles, roses to look like roses, etc.

Totes! I just meant that I suspect this is causing it, so we'd have to do some kind of workaround.

Actually, the "right" answer is to not allow such crazy axis behavior where the labels squash each other - maybe some kind of minimum figsize that keeps them looking ok - but I don't know if that would be easy to do at all.

jdemeyer commented 13 years ago

Milestone sage-4.7.3 deleted

kcrisman commented 13 years ago
comment:5

Any ideas how to rename the summary of this ticket? I do feel like we shouldn't return quite that skinny of a plot in terms of crushed labels... or Jason, do you feel like this should be closed since there isn't an error in 4.7.2?

kcrisman commented 13 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,4 @@
+In 4.7.1:

sage: polar_plot(1/sin(1.001*theta),(theta, pi/12,pi/2)) @@ -18,4 +19,6 @@

 though it looks terrible, see attached pictures.

+This no longer causes an error in 4.7.2, but the picture is still terrible.
+
 Hat tip to Bill Page at [this ask.sagemath.org question](http://ask.sagemath.org/question/862/polar_plot1sinthetatheta-pi12-pi2) for noticing the error.
jasongrout commented 13 years ago
comment:6

Well, the picture is certainly ugly, so let's fix it. I'll put it as minor, though.