Giter Club home page Giter Club logo

ipyplot's Introduction

Build PyPI - version PyPI - Downloads license

Share:
Twitter URL LinkedIn URL

IPyPlot is a small python package offering fast and efficient plotting of images inside Jupyter Notebooks cells. It's using IPython with HTML for faster, richer and more interactive way of displaying big number of images.

Displaying huge numbers of images with Python in Notebooks always was a big pain for me as I always used matplotlib for that task and never have I even considered if it can be done faster, easier or more efficiently.
Especially in one of my recent projects I had to work with a vast number of document images in a very interactive way which led me to forever rerunning notebook cells and waiting for countless seconds for matplotlib to do it's thing..
My frustration grew up to a point were I couldn't stand it anymore and started to look for other options..
Best solution I found involved using IPython.display function in connection with simple HTML. Using that approach I built a simple python package called IPyPlot which finally helped me cure my frustration and saved a lot of my time

Features:

  • Easy, fast and efficient plotting of images in python within notebooks
  • Plotting functions (see examples section to learn more:
    • plot_images - simply plots all the images in a grid-like manner
    • plot_class_representations - similar to plot_images but displays only a single image per class (based on provided labels collection)
    • plot_class_tabs - plots images in a grid-like manner in a separate tab for each class based on provided label
  • Supported notebook platforms:
    • Jupyter
    • Google Colab
    • Azure Notebooks
    • Kaggle Notebooks
  • Supported image formats:
    • Array of local storage URLs, e.g. [your/dir/img1.jpg]
    • Array of remote URLs, e.g. [http://yourimages.com/img1.jpg]
    • Array of PIL.Image objects
    • Array of images as numpy.ndarray objects
  • Misc:
    • force_b64 flag to force conversion of images from URLs to base64 format

Getting Started

Checkout the examples below and gear-images-examples.ipynb notebook which holds end to end examples for using IPyPlot.

Installation

IPyPlot can be installed directly from this repo using pip:

pip install git+https://github.com/karolzak/ipyplot

or through PyPI

pip install ipyplot

Usage examples

IPyPlot offers 3 main functions which can be used for displaying images in notebooks:

To start working with IPyPlot you need to simply import it like this:

import ipyplot

and use any of the available plotting functions shown below (notice execution times).
images - should be a numpy array of either string (image file paths), PIL.Image objects or numpy.array objects representing images
labels - should be a numpy array of string

Display images in separate, interactive tabs for each class

Display a collection of images

Display class representations (first image for each class)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.