Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on the same plot. My code is given below. However, this only produces graphs in first and second subplots. What am I missing?
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
'''Load a graph''' g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1) gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
Can somebody kindly help me with this? I am completely stuck.
Thank you
On Thu, Jul 27, 2017 at 2:12 PM, Snehal Shekatkar <snehalshekatkar@gmail.com
wrote:
Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on the same plot. My code is given below. However, this only produces graphs in first and second subplots. What am I missing?
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
'''Load a graph''' g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1) gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
-- Snehal M. Shekatkar Pune India
Funny thing, messing around with your example I find that graph_draw seems to be drawing onto the wrong axis: when you pass axis 3 it draws inside aixs 1, passing axis 4 draws inside axis 2, and what you pass as axes 1 and 2 is likely being drawn outside the canvas. Also, if you exapnd to 8 axes, it plots only 4 of them, so it seems things are being shifted halfway updards before drawing. I looked at the code but having never played with Cairo it is not evident what could be wrong, but hopefully this will help.
.~´
On Sat, Jul 29, 2017 at 6:25 AM, Snehal Shekatkar <snehalshekatkar@gmail.com
wrote:
Can somebody kindly help me with this? I am completely stuck.
Thank you
On Thu, Jul 27, 2017 at 2:12 PM, Snehal Shekatkar < snehalshekatkar@gmail.com> wrote:
Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on the same plot. My code is given below. However, this only produces graphs in first and second subplots. What am I missing?
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
'''Load a graph''' g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1) gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
-- Snehal M. Shekatkar Pune India
-- Snehal M. Shekatkar Pune India
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
Thanks for the reply. I don't think that there is any issue with graph tool. It simply looks like ignorance on my part because I have seen some figures in Tiago's papers which contain many network papers.
On Sat, Jul 29, 2017 at 8:36 PM, Alexandre Hannud Abdo abdo@member.fsf.org wrote:
Funny thing, messing around with your example I find that graph_draw seems to be drawing onto the wrong axis: when you pass axis 3 it draws inside aixs 1, passing axis 4 draws inside axis 2, and what you pass as axes 1 and 2 is likely being drawn outside the canvas. Also, if you exapnd to 8 axes, it plots only 4 of them, so it seems things are being shifted halfway updards before drawing. I looked at the code but having never played with Cairo it is not evident what could be wrong, but hopefully this will help.
.~´
On Sat, Jul 29, 2017 at 6:25 AM, Snehal Shekatkar < snehalshekatkar@gmail.com> wrote:
Can somebody kindly help me with this? I am completely stuck.
Thank you
On Thu, Jul 27, 2017 at 2:12 PM, Snehal Shekatkar < snehalshekatkar@gmail.com> wrote:
Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on the same plot. My code is given below. However, this only produces graphs in first and second subplots. What am I missing?
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
'''Load a graph''' g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1) gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
-- Snehal M. Shekatkar Pune India
-- Snehal M. Shekatkar Pune India
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
Dear Tiago,
Can you kindly suggest some solution on this?
Thank you
On Mon, Jul 31, 2017 at 8:11 PM, Snehal Shekatkar <snehalshekatkar@gmail.com
wrote:
Thanks for the reply. I don't think that there is any issue with graph tool. It simply looks like ignorance on my part because I have seen some figures in Tiago's papers which contain many network papers.
On Sat, Jul 29, 2017 at 8:36 PM, Alexandre Hannud Abdo < abdo@member.fsf.org> wrote:
Funny thing, messing around with your example I find that graph_draw seems to be drawing onto the wrong axis: when you pass axis 3 it draws inside aixs 1, passing axis 4 draws inside axis 2, and what you pass as axes 1 and 2 is likely being drawn outside the canvas. Also, if you exapnd to 8 axes, it plots only 4 of them, so it seems things are being shifted halfway updards before drawing. I looked at the code but having never played with Cairo it is not evident what could be wrong, but hopefully this will help.
.~´
On Sat, Jul 29, 2017 at 6:25 AM, Snehal Shekatkar < snehalshekatkar@gmail.com> wrote:
Can somebody kindly help me with this? I am completely stuck.
Thank you
On Thu, Jul 27, 2017 at 2:12 PM, Snehal Shekatkar < snehalshekatkar@gmail.com> wrote:
Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on the same plot. My code is given below. However, this only produces graphs in first and second subplots. What am I missing?
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
'''Load a graph''' g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1) gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
-- Snehal M. Shekatkar Pune India
-- Snehal M. Shekatkar Pune India
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India
On 02.08.2017 07:53, Snehal Shekatkar wrote:
Can you kindly suggest some solution on this?
There seems to be a problem with the code, as Alexandre pointed out. I need to take a closer look, but I'm out of time.
Please refrain from posting repeated messages like this. If I haven't answered yet, is because I did not have a chance. Posting more messages does not help.
Best, Tiago
Hi Tiago,
I am on Ubuntu 16.04 and today I updated from git: '2.23 (commit b669e1b7, Sun Sep 24 00:01:08 2017 +0200)'.
Till now, I was at least able to draw two graphs in two subplots as said in my previous email. However, today even that is not working. My code:
import graph_tool.all as gt import matplotlib.pyplot as plt plt.switch_backend('cairo')
g1 = gt.collection.data['karate'] g2 = gt.collection.data['dolphins']
ax = plt.subplot(1, 2, 1) gt.graph_draw(g1, mplfig = ax) ax = plt.subplot(1, 2, 2) gt.graph_draw(g2, mplfig = ax) ax = plt.subplot(2, 2, 3)
plt.savefig('test.pdf')
I get the following error:
Traceback (most recent call last): File "test.py", line 20, in <module> plt.savefig('abc.pdf') File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 688, in savefig res = fig.savefig(*args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1565, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2232, in print_figure **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_cairo.py", line 448, in print_pdf return self._save(fobj, 'pdf', *args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_cairo.py", line 512, in _save self.figure.draw (renderer) File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1159, in draw func(*args) File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2324, in draw a.draw(renderer) File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 1570, in draw self.vorder, self.eorder, self.nodesfirst, self.kwargs) File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 692, in cairo_draw vdefs = _attrs(_vdefaults, "v", g, vcmap)[1] File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 486, in _attrs defaults[int(attr)] = _convert(attr, v, cmap) File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 323, in _convert cmap, alpha = cmap ValueError: not enough values to unpack (expected 2, got 0)
I tried looking into "cairo_darw.py" but couldn't locate the problem. I think that it might have something to do with the default color map default_cm but I am not sure about it. Can you kindly help me with this?
Thank you
On Wed, Aug 2, 2017 at 3:22 PM, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 02.08.2017 07:53, Snehal Shekatkar wrote:
Can you kindly suggest some solution on this?
There seems to be a problem with the code, as Alexandre pointed out. I need to take a closer look, but I'm out of time.
Please refrain from posting repeated messages like this. If I haven't answered yet, is because I did not have a chance. Posting more messages does not help.
Best, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
On 03.10.2017 10:06, Snehal Shekatkar wrote:
I tried looking into "cairo_darw.py" but couldn't locate the problem. I think that it might have something to do with the default color map default_cm but I am not sure about it. Can you kindly help me with this?
This is a bug. Please open an issue at the website and I will deal with it.
Best, Tiago
Dear Tiago,
Is there any workaround to this mplfig bug before it gets fixed? I am manually trying to merge the output files of individual graphs in gimp but that reduces the quality of the plots too much.
Thank you Snehal
On Tue, Oct 3, 2017 at 3:34 PM, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 03.10.2017 10:06, Snehal Shekatkar wrote:
I tried looking into "cairo_darw.py" but couldn't locate the problem. I think that it might have something to do with the default color map default_cm but I am not sure about it. Can you kindly help me with this?
This is a bug. Please open an issue at the website and I will deal with it.
Best, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
Hi Snehal. Hm. There is no reason why you should lose resolution while merging files, with gimp or any other tool. Perhaps you should be setting your new document to 4 times the resolution of the original, if you're merging 4 files. Otherwise if you're working with SVGs you might prefer Inkscape, which works directly on vector graphics. Saudações, ale
On Saturday, October 14, 2017, Snehal Shekatkar snehalshekatkar@gmail.com wrote:
Dear Tiago,
Is there any workaround to this mplfig bug before it gets fixed? I am manually trying to merge the output files of individual graphs in gimp but that reduces the quality of the plots too much.
Thank you Snehal
On Tue, Oct 3, 2017 at 3:34 PM, Tiago de Paula Peixoto <tiago@skewed.de javascript:_e(%7B%7D,'cvml','tiago@skewed.de');> wrote:
On 03.10.2017 10:06, Snehal Shekatkar wrote:
I tried looking into "cairo_darw.py" but couldn't locate the problem. I think that it might have something to do with the default color map default_cm but I am not sure about it. Can you kindly help me with this?
This is a bug. Please open an issue at the website and I will deal with it.
Best, Tiago
-- Tiago de Paula Peixoto <tiago@skewed.de javascript:_e(%7B%7D,'cvml','tiago@skewed.de');>
graph-tool mailing list graph-tool@skewed.de javascript:_e(%7B%7D,'cvml','graph-tool@skewed.de'); https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India
Thanks Alexandre for the reply. In some sense, it is true that gimp doesn't deter the quality if I adjust the resolutions properly. My problem is that when I include those plots in latex, the resulting plots in the output pdf look really bad. I tried using higher edge_pen_width as well as putting a black hollow around the vertices but doesn't improve that much.
Snehal
On Sun, Oct 15, 2017 at 5:29 AM, Alexandre Hannud Abdo abdo@member.fsf.org wrote:
Hi Snehal. Hm. There is no reason why you should lose resolution while merging files, with gimp or any other tool. Perhaps you should be setting your new document to 4 times the resolution of the original, if you're merging 4 files. Otherwise if you're working with SVGs you might prefer Inkscape, which works directly on vector graphics. Saudações, ale
On Saturday, October 14, 2017, Snehal Shekatkar snehalshekatkar@gmail.com wrote:
Dear Tiago,
Is there any workaround to this mplfig bug before it gets fixed? I am manually trying to merge the output files of individual graphs in gimp but that reduces the quality of the plots too much.
Thank you Snehal
On Tue, Oct 3, 2017 at 3:34 PM, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 03.10.2017 10:06, Snehal Shekatkar wrote:
I tried looking into "cairo_darw.py" but couldn't locate the problem. I think that it might have something to do with the default color map default_cm but I am not sure about it. Can you kindly help me with
this?
This is a bug. Please open an issue at the website and I will deal with it.
Best, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
On 15.10.2017 05:09, Snehal Shekatkar wrote:
Thanks Alexandre for the reply. In some sense, it is true that gimp doesn't deter the quality if I adjust the resolutions properly. My problem is that when I include those plots in latex, the resulting plots in the output pdf look really bad. I tried using higher edge_pen_width as well as putting a black hollow around the vertices but doesn't improve that much.
There are many options available, e.g. you can join using inkscape, or much more simply, you can just include several files in the same figure in LaTeX.
Using gimp is often a bad idea since it rasterizes the figure into a bitmap, where often it's best to preserve the image as a PDF, for example.
In any case, you can find this sort of information in many other places, and is not really a good subject for this mailing list: http://bfy.tw/EU3S
Thank you, Tiago for the suggestions.
On Sun, Oct 15, 2017 at 6:10 PM, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 15.10.2017 05:09, Snehal Shekatkar wrote:
Thanks Alexandre for the reply. In some sense, it is true that gimp
doesn't
deter the quality if I adjust the resolutions properly. My problem is
that
when I include those plots in latex, the resulting plots in the output
look really bad. I tried using higher edge_pen_width as well as putting a black hollow around the vertices but doesn't improve that much.
There are many options available, e.g. you can join using inkscape, or much more simply, you can just include several files in the same figure in LaTeX.
Using gimp is often a bad idea since it rasterizes the figure into a bitmap, where often it's best to preserve the image as a PDF, for example.
In any case, you can find this sort of information in many other places, and is not really a good subject for this mailing list: http://bfy.tw/EU3S
-- Tiago de Paula Peixoto tiago@skewed.de
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool