Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork42
IPyPlot is a small python package offering fast and efficient plotting of images inside Python Notebooks. It's using IPython with HTML for faster, richer and more interactive way of displaying big numbers of images.
License
karolzak/ipyplot
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
IPyPlot is a small python package offering fast and efficient plotting of images inside Python Notebooks cells. It's using IPython with HTML for faster, richer and more interactive way of displaying big numbers of images.
Displaying big numbers of images with Python in Notebooks always was a big pain for me as I always usedmatplotlib
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 formatplotlib
to do it's thing..
My frustration grew up to the point were I couldn't stand it anymore and started to look for other options..
Best solution I found involved usingIPython
package in connection with simple HTML. Using that approach I built this simple python package calledIPyPlot which finally helped me cure my frustration and saved a lot of my time.
- Easy, fast and efficient plotting of images in python within notebooks
- Plotting functions (seeexamples section to learn more):
plot_images
- simply plots all the images in a grid-like layoutplot_class_representations
- similar toplot_images
but displays only the first image for each label/class (based on provided labels collection)plot_class_tabs
- plots images in a grid-like manner in a separate tab for each label/class based on provided labels
- Supported image formats:
- Sequence of local storage URLs, e.g.
[your/dir/img1.jpg]
- Sequence of remote URLs, e.g.
[http://yourimages.com/img1.jpg]
- Sequence of
PIL.Image
objects - Sequence of images as
numpy.ndarray
objects - Supported sequence types:
list
,numpy.ndarray
,pandas.Series
- Sequence of local storage URLs, e.g.
- Misc features:
custom_texts
param to display additional texts like confidence score or some other information for each imageforce_b64
flag to force conversion of images from URLs to base64 format- click on image to enlarge
- control number of displayed images and their width through
max_images
andimg_width
params - "show html" button which reveals the HTML code used to generate plots
- option to set specific order of labels/tabs, filter them or ignore some of the labels
- Supported notebook platforms:
- Jupyter
- Google Colab
- Azure Notebooks
- Kaggle Notebooks
To start using IPyPlot, seeexamples below or go togear-images-examples.ipynb notebook which takes you through most of the scenarios and options possible withIPyPlot.
IPyPlot can be installed throughPyPI:
pip install ipyplot
or directly from this repo usingpip
:
pip install git+https://github.com/karolzak/ipyplot
IPyPlot offers 3 main functions which can be used for displaying images in notebooks:
To start working withIPyPlot
you need to simply import it like this:
importipyplot
and use any of the available plotting functions shown below (notice execution times).
- images - should be a sequence of either
string
(local or remote image file URLs),PIL.Image
objects ornumpy.ndarray
objects representing images - labels - should be a sequence of
string
orint
images= ["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]ipyplot.plot_images(images,max_images=30,img_width=150)
images= ["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]labels= ['label1','label2','label3']ipyplot.plot_class_representations(images,labels,img_width=150)
images= ["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]labels= ['class1','class2','class3']ipyplot.plot_class_tabs(images,labels,max_imgs_per_tab=10,img_width=150)
To learn more about what you can do with IPyPlot go togear-images-examples.ipynb notebook for more complex examples.
About
IPyPlot is a small python package offering fast and efficient plotting of images inside Python Notebooks. It's using IPython with HTML for faster, richer and more interactive way of displaying big numbers of images.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.