Skip to content

[BUG] Node/edge colors not running #241

Description

@Cedricyf

Describe the bug
When setting the node or edge color, the figure only show the black color (using the exact code for the honeydot example)
To Reproduce

Browser environment (please complete the following information):

  • OS: mac
  • Browser chrome
  • Version [e.g. 22]

PyGraphistry environment

  • Version 0.19.0
  • Python Version 3.8
  • Where run jupyter
    Screen Shot 2021-07-09 at 12 10 37 PM

Activity

  1. lmeyerov commented on Jul 9, 2021

    @lmeyerov
    Contributor

    Thanks @Cedricyf !

    We have a regression on the free Graphistry Hub relating to a bunch of library upgrades yesterday -- are you on Hub or a private server?

    Edit: I see v2.37.23 in the screenshot, so looks like Hub. Will ping when fixed!

  2. changed the title [-][BUG] [/-] [+][BUG] Node/edge colors not running[/+] on Jul 9, 2021
  3. lmeyerov commented on Jul 10, 2021

    @lmeyerov
    Contributor

    @Cedricyf

    I took a look -- can you try setting graphistry.register(api=3, username='...', password='...') at the top and rerun? This may be an issue around using api=1 or api=2 protocols, which we can help with, but better to use api=3

    Later today, will be releasing a new version of this notebook that is in a more modern style, including explicitly using api=3 features

  4. Cedricyf commented on Jul 12, 2021

    @Cedricyf
    Author

    Hi @lmeyerov,
    What I have used is api=3 with my username and password. I just tried the new version, the color is still black/white and I used numeric value for the point_color parameter.
    Thank you!

  5. lmeyerov commented on Jul 12, 2021

    @lmeyerov
    Contributor

    Hi @Cedricyf I think I see what's happening.

    When passing in a color attribute column, vs using a symbolic encoding, we handle int32 as palettes and int64 as rgb hex values. I'm guessing you are using an unexpected type or value range. You can check what g._nodes.info() shows to see which you are using, and pandas as_type to convert. You can find more examples and the int32 palettes here: https://hub.graphistry.com/docs/api/2/rest/upload/colors/#extendedpalette2

    Let me know how goes!


    Quick example of both:

    graphistry.register(api=3, username='...', password='...')
    
    g = (graphistry
         .edges(
             pd.DataFrame({
                 's': ['a', 'b', 'c'],
                 'd': ['b', 'c', 'a']}),
             's', 'd')
         .nodes(
             pd.DataFrame({
                 'n': ['a', 'b', 'c'],
                 'c32': pd.Series([0, 1, 2], dtype='int32'),
                 # format is 0xRRGGBB00
                 'c64': pd.Series([0xFF000000, 0x00FF0000, 0x0000FF00], dtype='int64')
             }),
             'n'))
    
    g._nodes.info()

    =>

    <class 'pandas.core.frame.DataFrame'>
    RangeIndex: 3 entries, 0 to 2
    Data columns (total 3 columns):
     #   Column  Non-Null Count  Dtype 
    ---  ------  --------------  ----- 
     0   n       3 non-null      object
     1   c32     3 non-null      int32 
     2   c64     3 non-null      int64 
    dtypes: int32(1), int64(1), object(1)
    memory usage: 188.0+ bytes
    

    Then to plot:

    # int32 => palette
    g.bind(point_color='c32').plot()

    image

    # int64 => rgb int
    g.bind(point_color='c64').plot()

    =>

    image

  6. lmeyerov commented on Jul 13, 2021

    @lmeyerov
    Contributor

    I opened #243 to help here and will mark this as closed

    If can help further, or this isn't what's going on, would be happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions