Skip to content

Matplotlib and Seaborn inside Grasshopper 3D using Rhino Compute, Hops, and Flask. Enter the following link in Grasshopper.

Notifications You must be signed in to change notification settings

monsieurpablo/seaborn_grasshopper

Repository files navigation

Seaborn Grasshopper

A Rhino Remote library that brings Seaborn (Matplotlib) inside of Grasshopper using Hops.

This second version is a complete refactor of the seaborn-grasshopper implementation. This approach greatly improves from the first version in the following ways:

  • Additional fuctions added
    • despine Dictionary with "Despine" functions arguments, that removes top and right axis lines.
    • add_args Use additional figure arguments are not implemented in Grasshopper.
    • ax_args Implement axis arguments to the matplotlib.Axis element. (Set title, x and y limits, etc )
    • fig_size Change figure size
  • Ready for web deployment using Heroku and gunicorn
  • Export image as a encoded b64 string
  • Less code duplication
  • Correct handling of defaults
  • Style improvement

Typical workflow

Seaborn Grasshopper Author : Pablo Arango

Result examples

image Author : MaesAntoine

How to Deploy Your Own Local Server with Seaborn for Grasshopper 3D in 5 minutes

Requirements

  • Git: Version control is an important tool when working on projects, and Git is one of the most popular and widely-used version control systems. You can download Git here.
  • Virtual Environment Manager: This guide uses conda, but you can also use miniconda or other virtual environment managers. You can download conda here.

Step by step guide

  1. Clone the repository using the following command:
git clone https://github.com/monsieurpablo/seaborn_grasshopper

The command above will download the repository containing the code for the server and its dependencies.

  1. Navigate to the repository
cd seaborn_grasshopper

This command will take you inside the repository's folder, where you will be able to access the files and folders required to run the server.

  1. Create a virtual environment with Python 3.9 using conda
conda create --name ghseaborn python=3.9
conda activate ghseaborn

Conda allows you to create virtual environments, which are isolated spaces where you can install packages and dependencies without interfering with your system's Python installation. The first command creates an environment named ghseaborn with Python 3.10, and the second command activates the environment so that any packages you install will be installed in that environment.

  1. Install the dependencies listed in the requirements file:
pip install -r requirements.txt

This command will install all the packages and dependencies required to run the server, as listed in the requirements.txt file.

  1. Install waitress as a server handler (Windows only)
pip install waitress

Waitress is a lightweight web server that can be used to run the server. This command installs the waitress package, which is required to run the server on Windows.

  1. Start the server
waitress-serve --threads 6 --listen=*:5000 app:app

This command starts the server and makes it available on the localhost at port 5000. The --threads flag specifies the number of threads to use and the --listen flag specifies the IP address and port to listen on.

  1. Connect to the server in Grasshopper

Use the the following URL address: http://127.0.0.1:5000/ in the panel asking for the server address.

Congratulations!!!!! You can now connect to the server using the URL address provided and start using Seaborn with Grasshopper 3D.

From now on you can start the server by running the command waitress-serve --threads 6 --listen=*:5000 app:app from the repository's folder.

Server Deployment

Follow this tutorial. The code is already set-up to work with Render.

About

Matplotlib and Seaborn inside Grasshopper 3D using Rhino Compute, Hops, and Flask. Enter the following link in Grasshopper.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published