# polar_plot((1/sin(theta)),(theta, pi/12, pi/2))

In Sage notebook v 4.6.1 I wrote:

var('theta')
polar_plot((1/sin(theta)),(theta, pi/12, pi/2))


I got

libpng error: Image width or height is zero in IHDR
Traceback (click to the left of this block for traceback)
...
RuntimeError: Error building image


What am I doing wrong?

edit retag close merge delete

Sort by » oldest newest most voted

Thanks for the trac ticket.

Here is another one with a problem:

polar_plot(3*sqrt(cos(2*theta)),(theta, 0, 2*pi))


> ![image description](http://)
>


Arrrgh!

Well, ok try it yourslf. On my v.4.6.1 worksheet I see a plot with some weird discontinuity near the origin.

more

This is a different issue that is not really solvable in the same way. Try polar_plot(3*sqrt(cos(2*theta)),(theta, 0, 2*pi),plot_points=50000) for something that looks pretty good, though.

( 2011-11-04 12:52:23 +0200 )edit

Ok, yes with this option I do get a reasonable looking graph but I also get the message: verbose 0 (3998: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 24999 points. verbose 0 (3998: plot.py, generate_plot_points) Last error message: ''

( 2011-11-07 07:37:49 +0200 )edit

Yeah, but that's ok. I mean, you should have gotten that error for the one without the plot_points option set as well. That is because you are plugging in theta that give you a negative number inside the square root :) and plot ignores them but tells you that some of its points did that.

( 2011-11-07 10:50:55 +0200 )edit

I don't get an error, but I do get plots that are very stretched out. Even with

polar_plot((1/sin(theta)),(theta, pi/12, pi/2),aspect_ratio='auto')


the y-axis isn't as nice as when we do

plot(1,(x,0,3))

more

Really, you don't get an error? Your polar plot command gives me TypeError: can't multiply sequence by non-int of type 'float'.

( 2011-11-01 22:04:23 +0200 )edit

I am running 4.7.2 alpha3, I think. What version are you running?

( 2011-11-04 14:15:36 +0200 )edit

I was using 4.7.1, I think. Let me try... Yup, that part at least is fixed somewhere in 4.7.2.

( 2011-11-04 23:01:50 +0200 )edit

This isn't a full answer, but I think that there is something wrong with how we are doing the axes for polar plot - probably because of our aspect ratio handling (?).

Compare

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


with

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


and you'll see what I mean.

This is now Ticket 11978.

more