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

Special characters cause bug in visualization #32

Open
user1246638 opened this issue Nov 2, 2018 · 3 comments
Open

Special characters cause bug in visualization #32

user1246638 opened this issue Nov 2, 2018 · 3 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@user1246638
Copy link
Collaborator

Using some special characters results in all nodes being on top of eachother in the visualization. The characters include, but are probably not limited to:
"',[]{}!?:;.

At least warning would be useful, if this bug proves to be hard.

@IngoScholtes IngoScholtes self-assigned this Feb 14, 2019
@IngoScholtes IngoScholtes added bug Something isn't working help wanted Extra attention is needed labels Feb 14, 2019
@IngoScholtes
Copy link
Contributor

IngoScholtes commented Feb 14, 2019

Could you provide a minimal example for the bug?

The following works for me:

import pathpy as pp

#%%
n = pp.Network()
n.add_edge("'", '[')
n.add_edge('"', ']')
n.add_edge(':', ';')
n.add_edge('!', '?')
n.add_edge('{', '}')
n

@IngoScholtes IngoScholtes added the question Further information is requested label Feb 14, 2019
@maximelucas
Copy link

I've experienced the same problem using temporal networks. Here is an MWE of the bug, which displays smoothly if 'B/' is replaced by 'B':

import pathpy as pp

TN = pp.TemporalNetwork()

tedges = [('A', 'B/', 1),
            ('B/', 'C', 2),
            ('C', 'D', 3),
            ('D', 'A', 4),
           ]
for tedge in tedges :
    TN.add_edge(*tedge)
    
pp.visualisation.plot(TN)

Tested with the following characters, and none of them work for me:

symbols = ['`','~','!','@','#','$','%','^','&','*', '(',')',
           '+','=','{','[','}',']','|',':',';','"','<',',','>','.','?','/']

@IngoScholtes
Copy link
Contributor

Sorry for the late follow-up.

Indeed, this is an issue that is due to limitations on which characters can be used as node IDs in HTML and CSS. So, while this does not affect the inner workings of pathpy, it will prevent HTML-based visualisations from being rendered propertly.

For now, the only quick workaround is to write a function that takes care of special characters, making sure that node names conform to what can be used as valid ID attribute in HTML and CSS.

We are working on a new release of pathpy, in which we will fix this issue among others. Thank you very much for the report.

@IngoScholtes IngoScholtes added the enhancement New feature or request label Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants