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 8176629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:16:15+00:00 2026-06-06T23:16:15+00:00

Does anyone know if it is possible to have fine-grained control over line properties

  • 0

Does anyone know if it is possible to have fine-grained control over line properties when drawing networkx edges via (for example) draw_networkx_edges? I would like to control the line solid_capstyle and solid_joinstyle, which are (matplotlib) Line2D properties.

>>> import networkx as nx
>>> import matplotlib.pyplot as plt
>>> G = nx.dodecahedral_graph()
>>> edges = nx.draw_networkx_edges(G, pos=nx.spring_layout(G), width=7)
>>> plt.show()

In the example above, there are ‘gaps’ between the edges which I’d like to hide by controlling the capstyle. I thought about adding the nodes at just the right size to fill in the gaps, but the edges in my final plot are coloured, so adding nodes won’t cut it.
I can’t figure out from the documentation or looking at edges.properties() how to do what I want to do… any suggestions?

Carson

  • 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-06T23:16:17+00:00Added an answer on June 6, 2026 at 11:16 pm

    It looks like you can’t set the capstyle on matplotlib line collections.

    But you can make your own collection of edges using Line2D objects which allows you to control the capstyle:

    import networkx as nx
    import matplotlib.pyplot as plt
    from matplotlib.lines import Line2D
    G = nx.dodecahedral_graph()
    pos = nx.spring_layout(G)
    ax = plt.gca()
    for u,v in G.edges():
        x = [pos[u][0],pos[v][0]]
        y = [pos[u][1],pos[v][1]]
        l = Line2D(x,y,linewidth=8,solid_capstyle='round')
        ax.add_line(l)
    ax.autoscale()
    plt.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know if it's possible to have a bundle use the annotation reader
Does anyone know if it is possible to have resharper force the use of
Does anyone know if its possible to use phing to copy an entire folder
Does anyone know if its possible to turn off dreamweavers custom icons that it
Does anyone know if its possible to set the amount of memory available in
I was wondering does anyone know if its possible to open a wifi and
Does anyone know whether it is possible to refer to another section from the
Does anyone know if this is possible? I can't see to find much info
Does anyone know if it is possible to implement playback of an audio file
Does anyone know if it is possible to prevent a work item from being

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.