Skip to content

Commit

Permalink
0.5.0 Release (#10)
Browse files Browse the repository at this point in the history
* Bumping version

* Deprecate titlefont size

* Add deprecation warning

* Add gif

* Add makefile and ci

* Update ci
  • Loading branch information
Ashton-Sidhu committed Sep 30, 2022
1 parent c26e9c7 commit c778cd8
Show file tree
Hide file tree
Showing 9 changed files with 859 additions and 181 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Tests

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ on:

jobs:
deploy:

runs-on: macos-latest

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -20,13 +18,8 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
python -m pip install --upgrade poetry
poetry install
- name: Publish
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
poetry publish -u ${{ secrets.PYPI_USER }} -p '${{ secrets.PYPI_PASSWORD }}' --build
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: tests

tests:
poetry run pytest

tags:
git commit --allow-empty -m "Release $(rel)"
git push upstream --tags
git tag -a $(rel) -m "Version $(rel)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Interactive Graph Visualization (igviz) is a library to help visualize graphs interactively using Plotly. This library provides a customizable api for visualizing graphs in a neat, visually appealing plot. It keeps larger graphs much more clean by displaying minimal text information and highlights node properties and relationships using colour and size while providing the same text information when needed.

![Default Visualization](docs/images/default.png)
![Default Visualization](docs/images/graph.gif)

## Usage

Expand Down
Binary file added docs/images/graph.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions examples/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,25 @@
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/sidhu/plotly-graph/igviz/igviz.py:140: UserWarning: Argument `titlefont_size` is deprecated and will be removed in 0.6.0.\n",
" warn(\"Argument `titlefont_size` is deprecated and will be removed in 0.6.0.\")\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a697098e2f514a03ad6d6c6450929d33",
"model_id": "7ceb8c9798804ac8b63917ca388f229a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureWidget({\n",
" 'data': [{'hoverinfo': 'text',\n",
" 'line': {'color': '#888', 'width': 2},\n",
" 'line': {'color': '#888', 'width': 1},\n",
""
]
},
Expand All @@ -44,7 +52,7 @@
}
],
"source": [
"ig.plot(G)"
"ig.plot(G, node_opacity=0.8)"
]
},
{
Expand Down
27 changes: 15 additions & 12 deletions igviz/igviz.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List, Tuple, Union
from warnings import warn

import networkx as nx
import plotly.graph_objects as go
Expand All @@ -22,7 +23,7 @@ def plot(
annotation_text: str = None,
colorscale: str = "YlGnBu",
colorbar_title: str = None,
node_opacity: float = 1.0,
node_opacity: float = 0.8,
arrow_size: int = 2,
transparent_background: bool = True,
highlight_neighbours_on_hover: bool = True,
Expand Down Expand Up @@ -135,6 +136,12 @@ def plot(
Plotly figure of the graph
"""

warn(
"Argument `titlefont_size` is deprecated and will be removed in 0.6.0.",
DeprecationWarning,
stacklevel=2,
)

plot = PlotGraph(G, layout)

node_trace = plot.generate_node_traces(
Expand Down Expand Up @@ -294,7 +301,7 @@ def generate_edge_traces(
edge_trace = go.Scatter(
x=[],
y=[],
line=dict(width=2, color="#888"),
line=dict(width=1, color="#888"),
text=[],
hoverinfo="text",
mode=edge_mode,
Expand Down Expand Up @@ -470,22 +477,18 @@ def on_hover(

neighbours = list(self.G.neighbors(node))

c = list(trace.marker.color)
# s = list(trace.marker.size)
node_colours = list(trace.marker.color)

new_colors = ["#E4E4E4"] * len(c)
new_colors = ["#E4E4E4"] * len(node_colours)

new_colors[points.point_inds[0]] = c[points.point_inds[0]]
new_colors[points.point_inds[0]] = node_colours[points.point_inds[0]]

for i in neighbours:
trace_position = list(self.pos_dict).index(i)
for neighbour in neighbours:
trace_position = list(self.pos_dict).index(neighbour)
new_colors[trace_position] = node_colours[trace_position]

new_colors[trace_position] = c[trace_position]
# c[i] = "#EBEBEB"
# s[i] = 20
with self.f.batch_update():
trace.marker.color = new_colors
# trace.marker.size = s

def on_unhover(
self,
Expand Down
Loading

0 comments on commit c778cd8

Please sign in to comment.