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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:49:32+00:00 2026-06-18T10:49:32+00:00

Consider a plot of a very simple undirected graph produced with igraph. library(igraph) edges

  • 0

Consider a plot of a very simple undirected graph produced with igraph.

library(igraph)

edges = matrix(c(1,2), nrow=1, ncol=2)
g = graph.edgelist(edges, directed=FALSE)
set.seed(42)
plot(g, edge.width=2, vertex.size=30, edge.color='black', main='')

There is a small gap between the edge and vertex 2, but not between the edge and
vertex 1. Is there a way of removing that gap?

The graph I am really working with is larger and edges are a lot
shorter. While the gap goes almost unnoticed in the above example, it is
confusing in my case.

  • 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-18T10:49:33+00:00Added an answer on June 18, 2026 at 10:49 am

    This is indeed a bug in igraph, and it happens because igraph leaves some space there for the arrow-head, even if the arrow-head is not there. I will fix it in the next igraph version.

    As a workaround, what you can do is plotting each edge twice, on top of each other. For this you need to make your graph directed and then use the edge.arrow.mode option to avoid the arrows. This works because only one end of the edge is modified by the arrow plotter. Somewhat stupid to plot your graphs this way, but I cannot find a better workaround for now. As I said, the new version (the one after 0.6.4) will not have this problem.

    library(igraph)
    
    # Zoom in on the critical region, although the gap always has the 
    # same size, unless you make the plotting window bigger
    g <- graph(c(1,2), directed=FALSE)
    par(mar=c(0,0,0,0))
    plot(g, edge.width=2, vertex.size=20, edge.color='black', main='',
         rescale=FALSE, xlim=c(0.9,1), ylim=c(0.9,1),
         layout=rbind(c(0,0), c(1,1)), vertex.color="#ffffff11")
    

    gap

    # This plot should have no gaps
    g2 <- as.directed(g, mode="mutual")
    par(mar=c(0,0,0,0))
    plot(g2, edge.width=2, vertex.size=20, edge.color='black', main='',
         rescale=FALSE, xlim=c(0.9,1), ylim=c(0.9,1),
         layout=rbind(c(0,0), c(1,1)), vertex.color="#ffffff11",
         edge.arrow.mode="-") 
    

    no gap

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

Sidebar

Related Questions

Consider the following example: dat <- matrix(rexp(240, rate=.1), ncol=6) par(mfrow=c(3,2)) for (i in 1:6){
Consider this simple example: labNames <- c('xLab','yLabl') plot(c(1:10),xlab=expression(paste(labName[1], x^2)),ylab=expression(paste(labName[2], y^2))) What I want is
I noticed some weird behavior when resizing the plot window. Consider library(sp) library(rgeos) library(raster)
Consider something like figure plot(sin(0:0.01:pi)) axis tight set(gca,'box','on','ticklength',[0.02 0.05]) then export the graph to
Consider the example plot below. I'd like to make the little boxes around each
Consider the three-dimensional arrays A = rand(3,4,5); B = rand(3,4,5); plot(A(:,1,1),B(:,1,1)) plot(A(1,:,1),B(1,:,1)) This all
I'm using xtsExtra to plot two xts objects. Consider the following call to plot.xts:
I'd like to plot contours over a map produced with cartopy. If I run
Consider this simple controller: Porduct product = new Product(){ // Creating a product object;
Consider the following definition: f[x_]=Piecewise[{{0,x<1/2},{Interval[{0,1}],x==1/2},{1,x>1/2}}]; Then when one does the Plot[f[x],{x,0,1}] of the function,

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.