python-igraph icon indicating copy to clipboard operation
python-igraph copied to clipboard

Vertex size scaling is broken, it is not resolution-independent

Open szhorvat opened this issue 2 years ago • 11 comments

Describe the bug

When plotting graphs, the size of vertices should be independent of the resolution.

In short, the vertex sizes should be independent of the output format and of the output resolution.

To reproduce

Method 1:

from igraph import Graph, plot
g = Graph.Lattice([3,3])
plot(g, backend='matplotlib')

Now change the resolution and plot again:

import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 300
plot(g, backend='matplotlib')

Notice that the thickness of edges stays constant (they are just rendered at a higher resolution), but the size of vertices changes.

Method 2:

In a Jupyter notebook, set:

%matplotlib inline

Now plot, plot(g, backend='matplotlib')

Then set

%config InlineBackend.figure_format = 'retina'

and plot again.

image

Sizes in an SVG are different again.

image

Version information

0.11.2

szhorvat avatar Oct 15 '23 13:10 szhorvat