Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:58:29+00:00 2026-06-13T12:58:29+00:00

This is my first question on Stack Overflow, so my apologies if I’ve overlooked

  • 0

This is my first question on Stack Overflow, so my apologies if I’ve overlooked anything. I’m making a plot of cruise positions, and I am getting a double-parallel happening at 60 degrees North, with one being a straight line (on a stereographic projection).

Does anybody know what I’m doing to cause this?

My plotting script (referencing external data):

from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
import sys
import csv

dataFile = sys.argv[1]
dataStream = open(dataFile, 'rb')
dataReader = csv.reader(dataStream, delimiter=',')
numRows = sys.argv[2]

dataLat = []
dataLon = []

dataReader.next()
for row in dataReader:
    dataLon.append(float(row[5]))
    dataLat.append(float(row[6]))

m = Basemap(width=450000,height=150000,
        resolution='f',projection='stere',\
        lat_ts=65.4,lat_0=60.4,lon_0=1.91)

m.drawcoastlines(linewidth=0.2)
m.fillcontinents(color='white', lake_color='aqua')

x, y = m(dataLat,dataLon)
m.scatter(x,y,.5,marker='.',color='k')

m.drawparallels(np.arange(0.,81,1.), labels=[1,0,0,0], fontsize=10)
m.drawmeridians(np.arange(-180.,181.,5.), labels=[0,0,0,1], fontsize=10)
m.drawmapboundary(fill_color='aqua')

plt.title("Cruise Track")
plt.show()

Example:
Example plot

One other small question: what are the units of the width / height of the plot? It does not appear to be in the documentation, and I can’t find it mentioned on any tutorials, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:58:30+00:00Added an answer on June 13, 2026 at 12:58 pm

    Seems like a bug due to trying to fix another one.

    I don’t use basemap, but the first step to try and solve problems is to reduce them as much as possible:

    from mpl_toolkits.basemap import Basemap
    import matplotlib.pyplot as plt
    
    scale = 1
    m = Basemap(width=450000*scale,height=150000,
            resolution='i',projection='stere',
            lat_ts=65.4,lat_0=60.4,lon_0=1.91)
    
    parallels = [60]
    ret = m.drawparallels(parallels)
    plt.show()
    

    You can see in the docs that drawparallels returns a dict, and we can recover the actual Line2D (the parallel) and its data points:

    l = ret[60][0][0]
    x, y = l.get_data()
    

    If we have a look at the points, it doesn’t look bad unless we link them, and then we can see the annoying double parallel!

    plt.plot(x, y, '+')
    plt.show()
    

    + points

    plt.plot(x, y)
    plt.show()
    

    Linked points

    Let’s now try running the small example through the debugger (python -m pdb small_example.py).

    If you step inside the call to drawparallels, you’ll soon reach this code. It doesn’t look too good, so let’s skip the highlighted lines (using jump, if you’ve never used the Python debugger you should read a bit about it).

    And voilà, this is the result:

    Solved issue

    Taking into account where is the problem, it’s easy to guess that changing the width or height of the map (in meters, by the way) could get rid of the problem. Indeed, setting scale>=1.0485 works. Other combinations of width and height seem to work fine too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first question on Stack Overflow. Apologies in advance if I don't
This is my first question on Stack Overflow, so I hope that I'm clear
this is my first question on stack overflow. Some quick background, this is not
( Preface: This is my first audio-related question on Stack Overflow, so I'll try
First off - hello, this is my first Stack Overflow question so I'll try
this is my first question on stack overflow, so be gentle. Let me first
Hey there guys, this is my first question on Stack Overflow. I figured this
This is my first question here on stack overflow. i need help on a
this is my first question on stack overflow but I have some experience in
this is a first question on stack overflow, so please be patient. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.