Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • graph-tool graph-tool
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 48
    • Issues 48
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Tiago Peixoto
  • graph-toolgraph-tool
  • Merge requests
  • !39

Fix pen_width bug in cairo_draw

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Snehal Shekatkar requested to merge snehal/graph-tool:master into master Oct 31, 2020
  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

When user passes pen_width value only for either vertex or edge, an error is thrown since inside min_lw, lw may be None. This bug fixes that by assigning value lw=0.1 whenever it is 0.1

In the absence of this fix, the following code throws error:


import graph_tool.all as gt
g = gt.collection.data['karate']
gt.graph_draw(g, vertex_pen_width=5, vertex_color = 'k', output='test.png')

Actual error:

Traceback (most recent call last): File "test.py", line 4, in gt.graph_draw(g, vertex_pen_width=1, output='test.png') File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 1153, in graph_draw x, y, zoom = fit_to_view_ink(g, pos, output_size, vprops, File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 1345, in fit_to_view_ink eprops = dict(eprops, pen_width=min_lw(eprops.get("pen_width"))) File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 1342, in min_lw lw = max(lw, 0.1) TypeError: '>' not supported between instances of 'float' and 'NoneType'

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: master