python - pylab plot showing asymptotes -


how can remove asymptote?

import numpy np  e = 1.26 beta = .705 * np.pi rph = 7000 re = 6378  def r(nuh):     return rph * (1 + e) / (1 + e * np.cos(nuh + beta))   theta = np.linspace(-np.pi, np.pi, 50000)  fig2 = pylab.figure() ax2 = fig2.add_subplot(111) ax2.plot(r(theta) * np.cos(theta), r(theta) * np.sin(theta)) ax2.plot(rph * np.cos(theta), rph * np.sin(theta), 'r') #  adding earth                                                                  earth2 = pylab.circle((0, 0), radius = re, color = 'b') ax2.add_patch(earth2) pylab.xlim((-50000, 100000)) pylab.ylim((-50000, 100000)) pylab.show() 

with asymptotes

as can see here, setting divergent points np.nan cause them not plotted.

in problem, r(theta) diverges. define r , theta in usual way, then, want set extrema of r(theta) np.nan.

to this, make array first, change extrema np.nan:

rt = r(theta) ext = [np.argmin(rt), np.argmax(rt)] rt[ext] = np.nan 

now, sure plot modified rt array not original function:

ax2.plot(rt * np.cos(theta), rt * np.sin(theta)) 

no asymptotes :)


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -