Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help getting started #4

Closed
ACatAC opened this issue Sep 1, 2022 · 1 comment
Closed

help getting started #4

ACatAC opened this issue Sep 1, 2022 · 1 comment

Comments

@ACatAC
Copy link

ACatAC commented Sep 1, 2022

I am playing around with ts2vg and I am having a hard time with the plotting using igraph.
I try to compute the natural vg for a short time series, but when trying to plot it I get this error:

Traceback (most recent call last):
  File "\anaconda3\envs\DK_01\lib\site-packages\IPython\core\interactiveshell.py", line 3398, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-9a1fdcf342e8>", line 1, in <cell line: 1>
    ig.plot(nx_g, target='graph.pdf')
  File "\anaconda3\envs\DK_01\lib\site-packages\igraph\drawing\__init__.py", line 512, in plot
    result.save()
  File "\anaconda3\envs\DK_01\lib\site-packages\igraph\drawing\__init__.py", line 309, in save
    self._ctx.show_page()
igraph.drawing.cairo.MemoryError: out of memory

The file created is corrupted.

Here is my code:

import numpy as np
from ts2vg import NaturalVG
import igraph as ig

import matplotlib.pyplot as plt

# time domain
t = np.linspace(1, 40)
dt = np.diff(t)

# build series
x1 = np.sin(2*np.pi/10*t)
x2 = np.sin(2*np.pi/15*t)

y = x1 + x2

plt.plot(t, y, '.-')
plt.show()

# build HVG
g = NaturalVG()
g.build(y)

nx_g = g.as_igraph()

# plotting
ig.plot(nx_g, target='graph.pdf')

I am using ts2vg 1.0.0, igraph 0.9.11, and pycairo 1.21.0

@CarlosBergillos
Copy link
Owner

Hi! (and sorry for the late reply)

I ran the same code you provided and got no errors.
This is the result I got:
graph

I am using ts2vg 1.0.0 and igraph 0.10.1.

This seems to be an issue with igraph more than an issue with ts2vg so I don't think I can help you, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants