Skip to main content
[![Documentation Status](https://readthedocs.org/projects/local-visualizer/badge/?version=latest)](http://local-visualizer.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://travis-ci.org/psvishnu91/local_visualizer.svg?branch=master)](https://travis-ci.org/psvishnu91/local_visualizer)
[![PyPI version](https://badge.fury.io/py/local-visualizer.svg)](https://badge.fury.io/py/local-visualizer)

## LocalVisualizer

Simple python api to visualize the plots in a script.

* Free software: MIT license
* Documentation: https://local-visualizer.readthedocs.io
* PyPI: https://pypi.python.org/pypi/local-visualizer/

### Installation
``` bash
pip install local-visualizer
```

### Motivation
* When moving from an IPython notebook to a script, we lose the diagnostics
of visualizing pandas as tables and matplotlib plots.
* :class:`LocalViz` starts a local http server and creates a html file to
which pandas tables and matplotlib plots can be sent over.
* The html file is dynamically updated for long running scripts.

### Usage
``` python
import logging, sys, numpy as np, pandas as pd, matplotlib.pyplot as plt
import local_visualizer

plt.style.use('fivethirtyeight')
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

# Create the local visualizer instance
lviz = local_visualizer.LocalViz(html_file='lviz_test.html', port=9112)
# INFO:root:Starting background server at: http://localhost:9112/.
# INFO:local_visualizer:Click: http://carpediem:9112/lviz_test.html or http://localhost:9112/lviz_test.html

# Create plots which will be streamed to the html file.
lviz.h3('Matplotlib :o')
lviz.p(
'Wrap your plots in the figure context manager which takes '
'in the kwargs of plt.figure and returns a plt.figure object.',
)

with lviz.figure(figsize=(10, 8)) as fig:
x = np.linspace(-10, 10, 1000)
plt.plot(x, np.sin(x))
plt.title('Sine test')

lviz.hr()

# Visualize pandas dataframes as tables.
lviz.h3('Pandas dataframes')

df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat(
[df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
axis=1,
)
lviz.write(df)
```

### Output
This starts a HTTPServer and creates a html file which is dynamically updated
each time ``lviz`` is called.

![Output image]( https://i.imgur.com/jjwvAX2.png "The output of the above commands")

### Support and Requirements
Python 2.7 (requires only std libraries).

### API methods
1. `p`: paragraph
2. `br`: line break
3. `hr`: Horizontal rule with line breaks
4. `h1`, `h2`, ..., `h6`: Headers
5. `write`: Directly write text to the html document (or pass in a `pandas.DataFrame`)
6. `figure`: Context manager which accepts the kwargs of `plt.figure` and returns a `plt.figure` object
7. `start`: Applicable if `LocalViz` was initialized with `lazy=True`. Starts the server and creates the html file
8. `close`: Deletes the html file

### Credits
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
History
=======

0.1.0 (2017-11-05)
------------------

* First release on PyPI.


Metadata

Release files for local-visualizer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for local-visualizer 0.1.2
File Size Uploaded Provenance Actions
local_visualizer-0.1.2.tar.gz 11.7 kB Without provenance Details for local_visualizer-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for local-visualizer 0.1.2
File Interpreter ABI Platform Actions
local_visualizer-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for local_visualizer-0.1.2-py2.py3-none-any.whl

Total release size: 20.4 kB

Release files / local_visualizer-0.1.2.tar.gz

Download URL local_visualizer-0.1.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4ce5f15e4fb71a75889ae04956ec40fb73507cdcf70f6951bab13e828e0146da
BLAKE2b-256 checksum
How to use checksums
2a43258d5ec71c82b5d62bcfe9958bf739e52d80682cbd8c4a3d5c3a204b00a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / local_visualizer-0.1.2-py2.py3-none-any.whl

Download URL local_visualizer-0.1.2-py2.py3-none-any.whl
Size 8.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
50e41acd02c0aa3eec904baee4f727059c483bf404ea39a2f7733daccfc76506
BLAKE2b-256 checksum
How to use checksums
e0e9badd762ec366351cefb79a93181fe5d9a2d439cdb52227aaab4e9d9eec27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for local-visualizer 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page