Skip to content

Commit

Permalink
Merge pull request #42 from SarthakJariwala/v0.4.x
Browse files Browse the repository at this point in the history
Update example gallery and readme
  • Loading branch information
SarthakJariwala authored Sep 6, 2020
2 parents 49b8fed + ae827ae commit 01154c0
Show file tree
Hide file tree
Showing 32 changed files with 161 additions and 152 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sdist/*
docs/api/*
docs/_rst/*
docs/_build/*
docs/auto_examples/*
cover/*
MANIFEST

Expand Down
91 changes: 17 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,46 @@
[![Codecov](https://codecov.io/gh/SarthakJariwala/seaborn-image/branch/master/graph/badge.svg)](https://codecov.io/gh/SarthakJariwala/seaborn-image)
[![PyPI](https://img.shields.io/pypi/v/seaborn-image.svg)](https://pypi.org/project/seaborn-image/)
[![Documentation Status](https://readthedocs.org/projects/seaborn-image/badge/?version=latest)](https://seaborn-image.readthedocs.io/en/latest/?badge=latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)


<div class="row">

<a>
<img src="./examples/image_0.png" height="180" width="200">
<a href="https://seaborn-image.readthedocs.io/auto_examples/plot_image_hist.html">
<img src="./images/sphx_glr_plot_image_hist_001.png" height="120" width="170">
</a>

<a>
<img src="./examples/image_1.png" height="180" width="200">
<a href="https://seaborn-image.readthedocs.io/auto_examples/plot_filter.html">
<img src="./images/sphx_glr_plot_filter_001.png" height="120" width="130">
</a>

<a>
<img src="./examples/image_3.png" height="165" width="400">
<a href="https://seaborn-image.readthedocs.io/auto_examples/plot_fft.html">
<img src="./images/sphx_glr_plot_fft_001.png" height="120" width="120">
</a>

</div>

<div class="row">

<a>
<img src="./examples/image_5.png" height="250" width="375">
<a href="https://seaborn-image.readthedocs.io/auto_examples/plot_filtergrid.html">
<img src="./images/sphx_glr_plot_filtergrid_001.png" height="120" width="120">
</a>

</div>

<div class="row">

<a>
<img src="./examples/image_4.png" height="600" width="600">
<a href="https://seaborn-image.readthedocs.io/auto_examples/plot_image_robust.html">
<img src="./images/sphx_glr_plot_image_robust_001.png" height="120" width="260">
</a>

</div>


Seaborn-like image data visualization using matplotlib, scikit-image and scipy.

## Description

Seaborn-image is a seaborn like python **image** visualization and processing library
Seaborn-image is a seaborn-like python **image** visualization and processing library
based on matplotlib, scipy and scikit-image.

The aim of seaborn-image is to provide a high-level API to **process and plot attractive images quickly and effectively**.
The aim of `seaborn-image` is to provide a high-level API to **process and plot attractive images quickly and effectively**.

## Documentation

Check out the docs [here](https://seaborn-image.readthedocs.io/)
Check out the docs [here](https://seaborn-image.readthedocs.io/).


## Installation
Expand All @@ -58,57 +53,5 @@ pip install seaborn-image
```

## Usage
### Simple usage

```python

import seaborn_image as isns

"""Plot image"""
isns.imgplot(data)

"""Plot image with scalebar"""
isns.imgplot(data, dx=0.01, units="um")

"""Add colorbar label"""
isns.imgplot(data, dx=0.01, units="um", cbar_label="Height (nm)")
```
<a>
<img src="./examples/image_0.png" height="275" width="300">
</a>

### Plot image with a histogram

```python
import seaborn_image as isns

isns.imghist(data, dx=150, units="nm", cbar_label="Height (nm)", cmap="ice")
```

<a>
<img src="./examples/image_5.png" height="300" width="450">
</a>

### Set context like seaborn

```python

import seaborn_image as isns

isns.set_context("notebook") # Other options include paper, talk, presentation, poster
```

### Apply image filters (from scipy and skimage) and plot

```python

import seaborn_image as isns

isns.filterplot(data, filter="gaussian", sigma=5, cbar_label="Height (nm)")
```

<a>
<img src="./examples/image_3.png" height="260" width="600">
</a>

Check out the more information [here](https://seaborn-image.readthedocs.io/)
Check out the [quickstart guide](https://seaborn-image.readthedocs.io/en/latest/quickstart.html) and [examples](https://seaborn-image.readthedocs.io/auto_examples/index.html).
3 changes: 2 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
rm -rf $(BUILDDIR)/* $(AUTODOCDIR)
rm -rf $(BUILDDIR)/*
rm -rf auto_examples/

$(AUTODOCDIR): $(MODULEDIR)
mkdir -p $@
Expand Down
18 changes: 15 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxcontrib.images",
"sphinx_gallery.gen_gallery",
"matplotlib.sphinxext.plot_directive",
]
html_static_path = ["_static"]


# for matplotlib plot-directive
plot_include_source = True
plot_formats = [("png", 90)]
plot_html_show_formats = False
plot_html_show_source_link = False

# sphinx-gallery
sphinx_gallery_conf = {
"examples_dirs": "../examples", # path to your example scripts
"gallery_dirs": "auto_examples", # path to where to save gallery generated output
"image_scrapers": ("matplotlib"), # collect images created
"capture_repr": (),
"download_all_examples": False,
"line_numbers": False,
"show_memory": False,
"thumbnail_size": (500, 500),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down Expand Up @@ -76,7 +88,7 @@
"navbar_links": [
("Quickstart", "quickstart"),
("How-to?", "how_to"),
("Gallery", "gallery"),
("Gallery", "auto_examples/index"),
("Releases", "https://github.com/SarthakJariwala/seaborn-image/releases", True),
("Reference", "reference"),
],
Expand Down
26 changes: 0 additions & 26 deletions docs/gallery.rst

This file was deleted.

32 changes: 20 additions & 12 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@
seaborn-image: image data visualization
=======================================

.. list-table::
|img1| |img2| |img3| |img4|

* - .. image:: ../examples/image_1.png
:width: 150px
:height: 140px
.. |img1| image:: /auto_examples/images/thumb/sphx_glr_plot_image_hist_thumb.png
:width: 190px
:height: 180px

.. image:: ../examples/image_5.png
:width: 200px
:height: 140px
.. |img2| image:: /auto_examples/images/thumb/sphx_glr_plot_filter_thumb.png
:width: 140px
:height: 140px

.. image:: ../examples/image_4.png
:width: 140px
:height: 140px
.. |img3| image:: /auto_examples/images/thumb/sphx_glr_plot_fft_thumb.png
:width: 120px
:height: 120px

.. |img4| image:: /auto_examples/images/thumb/sphx_glr_plot_filtergrid_thumb.png
:width: 140px
:height: 140px

.. .. |img5| image:: /auto_examples/images/thumb/sphx_glr_plot_image_robust_thumb.png
.. :width: 200px
.. :height: 200px
Description
Expand All @@ -27,7 +35,7 @@ The aim of seaborn-image is to provide a high-level API to **process and plot at
**and effectively**.

To get started with ``seaborn_image``, check out the :doc:`quickstart page <quickstart>`.
To view example images, check out the :doc:`gallery page <gallery>`.
To view example images, check out the :doc:`gallery page <auto_examples/index>`.
For specific how-to questions, refer to the :doc:`how-to page <how_to>`.

Check out the source code on `github <https://github.com/SarthakJariwala/seaborn-image>`_.
Expand Down Expand Up @@ -84,7 +92,7 @@ Contents

Quickstart <quickstart>
How-to? <how_to>
Gallery <gallery>
Gallery <auto_examples/index>
License <license>
Authors <authors>
Changelog <https://github.com/SarthakJariwala/seaborn-image/releases>
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx==2.3.1
sphinx==3.2.1
sphinx-gallery==0.8.0
sphinx_bootstrap_theme==0.7.1
sphinxcontrib-images==0.9.2
4 changes: 4 additions & 0 deletions examples/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Example gallery
===============

Seaborn-image example gallery
Binary file removed examples/image_0.png
Binary file not shown.
Binary file removed examples/image_1.png
Binary file not shown.
Binary file removed examples/image_2.png
Binary file not shown.
Binary file removed examples/image_3.png
Binary file not shown.
Binary file removed examples/image_4.png
Binary file not shown.
Binary file removed examples/image_5.png
Binary file not shown.
9 changes: 0 additions & 9 deletions examples/image_plot.py

This file was deleted.

10 changes: 10 additions & 0 deletions examples/plot_fft.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Fast Fourier Transform
======================
"""

import seaborn_image as isns

img = isns.load_image("polymer")

_ = isns.fftplot(img, cmap="viridis", cbar=False, despine=False)
10 changes: 10 additions & 0 deletions examples/plot_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Image Filter
============
"""

import seaborn_image as isns

img = isns.load_image("polymer")

_ = isns.filterplot(img, "median", size=5, cmap="ice", despine=False)
19 changes: 19 additions & 0 deletions examples/plot_filtergrid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
FilterGrid
==========
"""

import seaborn_image as isns

img = isns.load_image("polymer")

g = isns.FilterGrid(
img,
"gaussian",
row="sigma",
col="mode",
sigma=[2, 3, 4],
mode=["reflect", "nearest", "mirror"],
despine=False,
cmap="magma",
)
12 changes: 12 additions & 0 deletions examples/plot_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Image plot
==========
"""

import seaborn_image as isns

img = isns.load_image("polymer")
img_scale = {"dx": 15, "units": "nm"}

_ = isns.imgplot(img, dx=15, units="nm", despine=False)
10 changes: 10 additions & 0 deletions examples/plot_image_hist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Image distribution
==================
"""
import seaborn_image as isns

img = isns.load_image("polymer")

_ = isns.imghist(img, cmap="YlGnBu_r", dx=15, units="nm", despine=False)
17 changes: 17 additions & 0 deletions examples/plot_image_robust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Outlier correction
==================
"""

import matplotlib.pyplot as plt

import seaborn_image as isns

img = isns.load_image("polymer outliers")

f, axes = plt.subplots(1, 2)

_ = isns.imgplot(img, ax=axes[0], cmap="inferno", despine=False)
_ = isns.imgplot(
img, ax=axes[1], robust=True, perc=(2, 99.99), cmap="inferno", despine=False
)
Binary file added images/sphx_glr_plot_fft_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sphx_glr_plot_filter_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sphx_glr_plot_filtergrid_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sphx_glr_plot_image_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sphx_glr_plot_image_hist_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sphx_glr_plot_image_robust_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import nox

locations = "src", "tests", "noxfile.py", "docs/conf.py"
locations = "src", "tests", "noxfile.py", "docs/conf.py", "examples"
nox.options.sessions = "safety", "tests", "xdoctest"


Expand Down
Loading

0 comments on commit 01154c0

Please sign in to comment.