From 0035702dc7340b1b7a7d8161c3721f7d73523500 Mon Sep 17 00:00:00 2001 From: Adam Schill Collberg Date: Fri, 4 Apr 2025 14:27:56 +0200 Subject: [PATCH 1/4] Mention Snowflake tables in integration docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Florentin Dörre --- docs/source/integration.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/integration.rst b/docs/source/integration.rst index 53ba45da..9e91a263 100644 --- a/docs/source/integration.rst +++ b/docs/source/integration.rst @@ -11,6 +11,7 @@ Pandas DataFrames ----------------- The ``neo4j-viz`` library provides a convenience method for importing data from Pandas DataFrames. +These DataFrames can be created from many sources, such as CSV files or :doc:`Snowflake tables<./tutorials/snowpark-example>`. It requires and additional dependency to be installed, which you can do by running: .. code-block:: bash From 93fe8401313698ad80f70c82f805efbd0a0e93d1 Mon Sep 17 00:00:00 2001 From: Adam Schill Collberg Date: Fri, 4 Apr 2025 14:28:37 +0200 Subject: [PATCH 2/4] Rename "Adjusting" -> "Customizing" in docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Florentin Dörre --- docs/source/{adjusting.rst => customizing.rst} | 4 ++-- docs/source/index.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename docs/source/{adjusting.rst => customizing.rst} (99%) diff --git a/docs/source/adjusting.rst b/docs/source/customizing.rst similarity index 99% rename from docs/source/adjusting.rst rename to docs/source/customizing.rst index bb39d5c9..6d453a1b 100644 --- a/docs/source/adjusting.rst +++ b/docs/source/customizing.rst @@ -1,5 +1,5 @@ -Adjusting the visualization -=========================== +Customizing the visualization +============================= Once created, a :doc:`VisualizationGraph object <./api-reference/visualization-graph>` can be modified in various ways to adjust what the visualization looks like the next time you render it. diff --git a/docs/source/index.rst b/docs/source/index.rst index 525e10be..acb79781 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -26,6 +26,6 @@ If you have a suggestion on how we can improve the library or want to report a p getting-started.nblink integration.rst rendering.rst - adjusting.rst + customizing.rst api-reference/index.rst tutorials/index.rst From b542e2cf0beae52e81a0f19e21edadee3d753eb9 Mon Sep 17 00:00:00 2001 From: Adam Schill Collberg Date: Fri, 4 Apr 2025 14:32:26 +0200 Subject: [PATCH 3/4] Fix some broken links on the docs index page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Florentin Dörre --- docs/source/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index acb79781..09d3b06e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -12,10 +12,10 @@ The library allows you to visualize graph data interactively in Python using a s The library wraps the `Neo4j Visualization JavaScript library (NVL) `_, and provides additional features for working with graph data in Python. Notably, there are convenience methods for importing data from `Pandas DataFrames `_, -`Neo4j Graph Data Science `_ and `Neo4j Database `. +`Neo4j Graph Data Science `_ and `Neo4j Database `_. -The source code is available on https://github.com/neo4j/python-graph-visualization[GitHub]. -If you have a suggestion on how we can improve the library or want to report a problem, you can create a https://github.com/neo4j/python-graph-visualization/issues/new[new issue]. +The source code is available on `GitHub `_. +If you have a suggestion on how we can improve the library or want to report a problem, you can create a `new issue `_. .. toctree:: From 9550e707d28fbfefa3a6e10c88b5193f86bd1136 Mon Sep 17 00:00:00 2001 From: Adam Schill Collberg Date: Fri, 4 Apr 2025 15:17:16 +0200 Subject: [PATCH 4/4] Add docs on color types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Florentin Dörre --- docs/source/customizing.rst | 14 ++++++++++++-- python-wrapper/src/neo4j_viz/node.py | 2 +- python-wrapper/src/neo4j_viz/relationship.py | 2 +- .../src/neo4j_viz/visualization_graph.py | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/source/customizing.rst b/docs/source/customizing.rst index 6d453a1b..397997e9 100644 --- a/docs/source/customizing.rst +++ b/docs/source/customizing.rst @@ -37,8 +37,18 @@ the first positional argument. By default the Neo4j color palette that works for both light and dark mode will be used. If you want to use a different color palette, you can pass a dictionary or iterable of colors as the ``colors`` parameter. -You can for example use the color palettes from the `palettable library `_ as in -the following example: +A color value can for example be either strings like "blue", or hexadecimal color codes like "#FF0000", or even a tuple of RGB values like (255, 0, 255). +Here is an example of providing a list of custom colors to the ``color_nodes`` method: + +.. code-block:: python + + # VG is a VisualizationGraph object + VG.color_nodes("caption", ["red", "#7fffd4", (255, 255, 255, 0.5), "hsl(270, 60%, 70%)"]) + +The full set of allowed values for colors are listed `here `_. + +Instead of defining your own colors, you could also for example use the color palettes from the `palettable library `_ as in +this snippet: .. code-block:: python diff --git a/python-wrapper/src/neo4j_viz/node.py b/python-wrapper/src/neo4j_viz/node.py index be1bf2e4..8718a497 100644 --- a/python-wrapper/src/neo4j_viz/node.py +++ b/python-wrapper/src/neo4j_viz/node.py @@ -37,7 +37,7 @@ class Node(BaseModel, extra="allow"): ) #: The size of the node as radius in pixel size: Optional[RealNumber] = Field(None, ge=0, description="The size of the node as radius in pixel") - #: The color of the node + #: The color of the node. Allowed input is for example "#FF0000", "red" or (255, 0, 0) color: Optional[ColorType] = Field(None, description="The color of the node") #: Whether the node is pinned in the visualization pinned: Optional[bool] = Field(None, description="Whether the node is pinned in the visualization") diff --git a/python-wrapper/src/neo4j_viz/relationship.py b/python-wrapper/src/neo4j_viz/relationship.py index 040da1d9..b5f4c640 100644 --- a/python-wrapper/src/neo4j_viz/relationship.py +++ b/python-wrapper/src/neo4j_viz/relationship.py @@ -41,7 +41,7 @@ class Relationship(BaseModel, extra="allow"): caption_size: Optional[Union[int, float]] = Field( None, gt=0.0, serialization_alias="captionSize", description="The size of the caption text" ) - #: The color of the relationship + #: The color of the relationship. Allowed input is for example "#FF0000", "red" or (255, 0, 0) color: Optional[ColorType] = Field(None, description="The color of the relationship") @field_serializer("color") diff --git a/python-wrapper/src/neo4j_viz/visualization_graph.py b/python-wrapper/src/neo4j_viz/visualization_graph.py index a017910c..a21bea32 100644 --- a/python-wrapper/src/neo4j_viz/visualization_graph.py +++ b/python-wrapper/src/neo4j_viz/visualization_graph.py @@ -205,6 +205,7 @@ def color_nodes(self, property: str, colors: Optional[ColorsType] = None, overri colors: The colors to use for the nodes. If a dictionary is given, it should map from property to color. If an iterable is given, the colors are used in order. + Allowed color values are for example “#FF0000”, “red” or (255, 0, 0) (full list: https://docs.pydantic.dev/2.0/usage/types/extra_types/color_types/). The default colors are the Neo4j graph colors. override: Whether to override existing colors of the nodes, if they have any.