Opened 4 years ago

Last modified 2 years ago

#21540 needs_work enhancement

Graph plotting: allow setting edge thickness in looped digraphs

Reported by: jmantysalo Owned by:
Priority: minor Milestone: sage-8.3
Component: graphics Keywords:
Cc: paulmasson, slelievre Merged in:
Authors: Johannes Huisman Reviewers: Ben Barros
Report Upstream: N/A Work issues:
Branch: u/johanneshuisman/digraph_plot_edge_thickness (Commits) Commit: 25a8b602af9b50c6d2f1e9458a5d1dc880f04236
Dependencies: Stopgaps:

Description

Try

sage: G = DiGraph({0: [0,1]}, loops=True)
sage: G.show()

The loop-edge from 0 to 0 is very small. However it is better with

G.show(edge_thickness=3)

Also I was asked why it has no arrow head. Maybe it could be added? But anyways, why thickness can not be changed in digraphs?

Change History (6)

comment:1 Changed 3 years ago by johanneshuisman

  • Authors set to Johannes Huisman
  • Branch set to u/johanneshuisman/digraph_plot_edge_thickness
  • Status changed from new to needs_review

Added edge_thickness functionality for digraphs. The problem was that arrow2d has width and not thickness.

comment:2 Changed 3 years ago by git

  • Commit set to 25a8b602af9b50c6d2f1e9458a5d1dc880f04236

Branch pushed to git repo; I updated commit sha1. New commits:

25a8b60added edge_thickness for digraphs

comment:3 Changed 3 years ago by johanneshuisman

  • Milestone changed from sage-7.4 to sage-7.6

changed milestone to 7.6

comment:4 Changed 3 years ago by johanneshuisman

Concerning the missing arrow heads on loops of directed graphs, they are missing since these loops are drawn as circles by using the circle command! Here is the relevant portion of graph_plot.py:

self._plot_components['edges'].append(circle((self._pos[a][0],
    self._pos[a][1]-curr_loop_size), curr_loop_size,
    rgbcolor=local_labels[i][1], **eoptions))

comment:5 Changed 3 years ago by bbarros

  • Reviewers set to Ben Barros
  • Status changed from needs_review to needs_work

The edge_thickness functionality only works for loops of fixed points. For example,

G = DiGraph({0: [0,1]},loops=True)
G.show(edge_thickness=1)
G.show(edge_thickness=15)

only changes the thickness of the loop at 0 and not the thickness of the arc from 0 to 1.

comment:6 Changed 2 years ago by slelievre

  • Cc slelievre added
  • Milestone changed from sage-7.6 to sage-8.3

See also #6546, #20035.

Note: See TracTickets for help on using tickets.