Skip to content

Commit

Permalink
Merge pull request #417 from jakobrunge/developer
Browse files Browse the repository at this point in the history
fixed bug with link labels
  • Loading branch information
jakobrunge authored Jul 1, 2024
2 parents a793db5 + 9039f95 commit 4a6a470
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run(self):
# Run the setup
setup(
name="tigramite",
version="5.2.5.10",
version="5.2.5.11",
packages=["tigramite", "tigramite.independence_tests", "tigramite.toymodels"],
license="GNU General Public License v3.0",
description="Tigramite causal inference for time series",
Expand Down
38 changes: 27 additions & 11 deletions tigramite/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2825,9 +2825,9 @@ def plot_graph(
else:
lags, sig_lags = [], []
if lag_array is not None:
dic["label"] = str([lag_array[l] for l in lags if l in sig_lags])[1:-1].replace(" ", "")
dic["label"] = ",".join([str(lag_array[l]) for l in lags if l in sig_lags]) #str([str(lag_array[l]) for l in lags if l in sig_lags])[1:-1].replace(" ", "")
else:
dic["label"] = str([l for l in lags if l in sig_lags])[1:-1].replace(" ", "")
dic["label"] = ",".join([str(l) for l in lags if l in sig_lags]) # str([str(l) for l in lags if l in sig_lags])[1:-1].replace(" ", "")
else:
# Node color is max of average autodependency
if no_coloring:
Expand Down Expand Up @@ -4498,9 +4498,25 @@ def write_csv(
import tigramite.data_processing as pp
from tigramite.causal_effects import CausalEffects

graph = np.zeros((3,3,3), dtype='<U3')
graph[0,1,2] = "-->"
graph[0,1,1] = "-->"
graph[0,1,0] = "-->"; graph[1,0,0] = "<--"

plot_graph(graph=graph,
# val_matrix=val_matrix,
# figsize=(5, 5),
# var_names = ['Var %s' %i for i in range(len(graph))],
# arrow_linewidth=6,
# label_space_left = label_space_left,
# label_space_top = label_space_top,
# # network_lower_bound=network_lower_bound,
save_name="test.pdf"
)


# T = 1000
def lin_f(x): return x
# def lin_f(x): return x
# auto_coeff = 0.3
# coeff = 1.
# links = {
Expand Down Expand Up @@ -4532,14 +4548,14 @@ def lin_f(x): return x
# verbosity=1)


correlations = np.random.rand(3, 3, 5) - 0.5 #pcmci.get_lagged_dependencies(tau_max=20, val_only=True)['val_matrix']
lag_func_matrix = plot_lagfuncs(val_matrix=correlations, setup_args={
'label_space_left':0.05,
'minimum': 0.0,
'maximum':.05,
'x_base':5,
'y_base':.5})
plt.show()
# correlations = np.random.rand(3, 3, 5) - 0.5 #pcmci.get_lagged_dependencies(tau_max=20, val_only=True)['val_matrix']
# lag_func_matrix = plot_lagfuncs(val_matrix=correlations, setup_args={
# 'label_space_left':0.05,
# 'minimum': 0.0,
# 'maximum':.05,
# 'x_base':5,
# 'y_base':.5})
# plt.show()


# N = len(links)
Expand Down

0 comments on commit 4a6a470

Please sign in to comment.