Using the library pyephem, I would like to find a way to do a nice plot (longitude, latitude) curves which represents the ground track of a satellite. I have computed the (longitude, latitude) but when longitude is over +180°, the next value computed is for example -178°, such that a segment is drawn, that makes bad figure.
Below the code that I have for the moment and the figure obtained.
currentDate = date.datetime(2018,12,1,0,0,0);
for i in range(nPoints):
iss.compute(currentDate)
# compute latitude
posLat[i] = iss.sublat*(180/math.pi)
# compute longitude
posLong[i] = iss.sublong*(180/math.pi)
currentDate = currentDate + date.timedelta(seconds = (time3orbits/nPoints*3600))
print currentDate, posLong[i], posLat[i]
plt.plot(posLong,posLat)
plt.show()
Here the figure that I get (for 3 orbits around earth):
How to prevent the segments drawn?
iss.sublat and iss.sublong are repectively the current latitude and longitude of iss position (from a currentDate fixed).

