Skip to main content

Remote Plot

PyPI version

Developing python code on a remote machine can get frustrating when you want to visualize your results. Instead of relying on a remote screen / X11 forwarding / VNC, Remote Plot opens your plots in a local server. It's a super simple library that replicates the API of matplotlib with a web renderer. All you need to do is forward the port to your machine. If your using VS Code, it will take care of it for you.

Getting started

Installation

pip install remote_plot

Port forwarding

If you are using VSCode, once you run your first plot, it will automatically forward the port and pop a dialog box that will let you open the plot in your web browser.

If you are using SSH, you can forward the port using he following flag while connecting to the remote machine:

ssh YOUR_USER_NAME@YOUR_MACHINE_IP -L 8000:localhost:8000

Then, you can just open localhost:8000 in a web browser once you run your first plot.

Your first plot

from remote_plot import plt

plt.plot([1, 2, 3], [4, 5, 6])

A more advanced example

Here's a more advnaced example taken from (the official matplotlib documentation)[https://matplotlib.org/stable/tutorials/introductory/pyplot.html#working-with-text]

from remote_plot import plt
import numpy as np

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75)


plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()

Check the (examples directory)[https://github.com/itaicaspi/remote_plot/examples] for more examples.

API

Remote plot is intended to act as a drop-in replacement to matplotlib. Because of this, it replicates the matplotlib API, which you can find here.

By default, every call plot will automatically render the result (equivalent to calling plt.show() on matplotlib). This can make things a bit slow, so if you prefer to turn it off, set plt.auto_show = False, and use plt.show() as usual.

It also supports native image displaying that can display numpy array or pillow images.

from PIL import Image
img = Image.open("PATH TO YOUR IMAGE")
plt.imshow_native(img)

Changing the web server port

from remote_plot import plt

plt.port = 8001

License

MIT License. See LICENSE for further details.

Metadata

Release files for remote-plot 1.2.1

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

Source distribution (sdist)

Source distribution for remote-plot 1.2.1
File Size Uploaded Provenance Actions
remote_plot-1.2.1.tar.gz 6.9 kB Without provenance Details for remote_plot-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for remote-plot 1.2.1
File Interpreter ABI Platform Actions
remote_plot-1.2.1-py3-none-any.whl Python 3 none any Details for remote_plot-1.2.1-py3-none-any.whl

Total release size: 14.2 kB

Release files / remote_plot-1.2.1.tar.gz

Download URL remote_plot-1.2.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0c7baaf1b14d2b88a5df632168042a02886cd00e73b34527f87fa3a8f2c76130
BLAKE2b-256 checksum
How to use checksums
13e5f830c681b8cc581bc5bf5f99fac0f7d94a6b1b22a8222d3cc4a75827c962
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / remote_plot-1.2.1-py3-none-any.whl

Download URL remote_plot-1.2.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3521bd579aa075bd53e041e414f7ca90f0e604456a1d90136d6c0168ce33b461
BLAKE2b-256 checksum
How to use checksums
b162fd144d4aa248ebaa7012bf118d4c1ad95d058b1ae6f5b8a454ba23c503b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for remote-plot 1.2.1

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