daleroberts / itermplot Goto Github PK
View Code? Open in Web Editor NEWAn awesome iTerm2 backend for Matplotlib, so you can plot directly in your terminal.
An awesome iTerm2 backend for Matplotlib, so you can plot directly in your terminal.
All information is in the title.
Workaround: use close() instead of clf() to make a new figure, it works fine.
This project is great!
It would be great if we could set the number of lines for the figure dynamically. Or even set it as an env var.
The first plot rendered using ITERMPLOT=rv has white axes and labels, and every other cycles between black and white.
Amazing work. Thanks.
Bug: I've noticed then you select "rv" mode in black terminal and plot contourf plots, then the colors for plt.colorbar() are not inverted.
Bpython seems to do something funny to the stdout
that corrupts the terminal escape characters. Is there a workaround?
I don't know how to diagnose this really, but I have ran sudo pip install itermplot
which installs to /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
on my system. My package path contains this directory
In [5]: sys.path
Out[5]:
['',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python35.zip',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/readline',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload',
'/Users/Rasmus/Library/Python/3.5/lib/python/site-packages',
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages', # <=====
'/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/extensions',
'/Users/Rasmus/.ipython']
I have also export
ed the MLPBACKEND
var:
echo $MPLBACKEND
module://itermplot
Still, when trying to run a script with plotting, I get an import error stating that the itermplot
module was not found. How can I diagnose this?
A number of keyword args are (apparently redundantly) passed to FigureCanvasAgg.print_png
resulting in warning message output above the png render:
/opt/homebrew/Caskroom/miniforge/base/envs/py392/lib/python3.9/site-packages/itermplot/__init__.py:243: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "facecolor" which is no longer supported as of 3.3 and will become an error two minor releases later
FigureCanvasAgg.print_png(self, filename, **kwargs)
/opt/homebrew/Caskroom/miniforge/base/envs/py392/lib/python3.9/site-packages/itermplot/__init__.py:243: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "edgecolor" which is no longer supported as of 3.3 and will become an error two minor releases later
FigureCanvasAgg.print_png(self, filename, **kwargs)
/opt/homebrew/Caskroom/miniforge/base/envs/py392/lib/python3.9/site-packages/itermplot/__init__.py:243: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "orientation" which is no longer supported as of 3.3 and will become an error two minor releases later
FigureCanvasAgg.print_png(self, filename, **kwargs)
/opt/homebrew/Caskroom/miniforge/base/envs/py392/lib/python3.9/site-packages/itermplot/__init__.py:243: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "bbox_inches_restore" which is no longer supported as of 3.3 and will become an error two minor releases later
FigureCanvasAgg.print_png(self, filename, **kwargs)
/opt/homebrew/Caskroom/miniforge/base/envs/py392/lib/python3.9/site-packages/itermplot/__init__.py:243: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "transparent" which is no longer supported as of 3.3 and will become an error two minor releases later
FigureCanvasAgg.print_png(self, filename, **kwargs)
Hi, I love this project. I am trying to set this up, but it is not working with TMUX (even without splits).
I managed to plot without TMUX (although the background is still black, I'm using a dark background).
I have installed the 0.5 version.
Tmux version: 3.3a
OS version:
Darwin 192.168.1.5 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu8792.61.2~4/RELEASE_ARM64_T8103 x86_64
The image in the main README showcases a screenshot of a retina display with a figure displayed inline in iTerm2. How to do this? All my attempts result in pixelated images.
I get the following error when trying to plot a heatmap with seaborn:
AttributeError: 'FigureCanvasItermplotPdf' object has no attribute 'get_renderer'
Here's a minimal example with the full error message:
>>> import pandas as pd
>>> import seaborn as sns
>>> df = pd.read_csv('results/lag_vs_forecast-2018-06-20T11:43:06.csv')
>>> piv = df.pivot('forecast', 'lag', 'mean_test_score')
>>> sns.heatmap(piv)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-5e2b2acd9fa7> in <module>()
----> 1 sns.heatmap(piv)
~/conda/lib/python3.6/site-packages/seaborn/matrix.py in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs)
526 if square:
527 ax.set_aspect("equal")
--> 528 plotter.plot(ax, cbar_ax, kwargs)
529 return ax
530
~/conda/lib/python3.6/site-packages/seaborn/matrix.py in plot(self, ax, cax, kws)
313
314 # Possibly rotate them if they overlap
--> 315 ax.figure.draw(ax.figure.canvas.get_renderer())
316 if axis_ticklabels_overlap(xtl):
317 plt.setp(xtl, rotation="vertical")
AttributeError: 'FigureCanvasItermplotPdf' object has no attribute 'get_renderer'
I can't post the CSV publicly, but I don't think it's necessary anyway.
Edit: Calling plt.show()
after the error still works and shows the heatmap, but the plot is not cleared. Future plots are drawn on top of the heatmap.
I'm drawing plots on a remote Ubuntu machine, which I've connected to over SSH and using iTerm2's tmux integration.
I got this issue:
./itermplot/test.py in ()
20 ax.set_title('Random graph')
21
---> 22 plt.show()
./lib/python2.7/site-packages/matplotlib/pyplot.pyc in show(*args, **kw)
250 """
251 global _show
--> 252 return _show(*args, **kw)
253
254
./itermplot/itermplot.pyc in show()
101 figmanager = Gcf.get_active()
102 if figmanager is not None:
--> 103 figmanager.show()
104 else:
105 for manager in Gcf.get_all_fig_managers():
./itermplot/itermplot.pyc in show(self)
214 self.canvas.print_figure(data, facecolor='none',
215 edgecolor='none', transparent=True)
--> 216 imgcat(data.getbuffer())
217
218 FigureCanvas = FigureCanvasPdf
AttributeError: '_io.BytesIO' object has no attribute 'getbuffer'
What's wrong with that?
In the README, the sample test subplots work fine in my usual terminal, but do not work in a tmux window.
However, when I plot a single subplot at a time, they do work.
This script is what I am referring to (from the README). Running the whole thing shows nothing. Calling plt.show() before drawing on the second subplot will correctly display first subplot. If I then draw second subplot and call plt.show() again, now the second shows but first disappears. When running the full script, neither show up, (in TMUX only seeing this issue).
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
plt.rcParams["font.size"] = 10
plt.figure(figsize=(8,3))
ax = plt.subplot(121)
x = np.arange(0,10,0.001)
ax.plot(x, np.sin(np.sinc(x)), 'r', lw=2)
ax.set_title('Nice wiggle')
ax = plt.subplot(122)
plt.tick_params(axis='both', left='off', top='off', right='off', bottom='off', labelleft='off', labeltop='off', labelright='off', labelbottom='off')
G = nx.random_geometric_graph(200, 0.125)
pos=nx.spring_layout(G)
nx.draw_networkx_edges(G, pos, alpha=0.2)
nx.draw_networkx_nodes(G, pos, node_color='r', node_size=12)
ax.set_title('Random graph')
plt.show()
I was trying to follow along with the pandas plot tutorial, but none of the examples work.
Perhaps Pandas is not supported?
The reverse video option is applied also in the pdf file which is produced in drag and drop, but it shouldn't as the background of the pdf file is white.
That's a very cool backend! I was wondering if you have had any chance of using it for plotting R plots from within R.
I'm sure python and R have completely different architectures, but I thought it was worth asking.
It seems to support only python 3.5 as I have this error with python 3.4:
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3])
[<matplotlib.lines.Line2D object at 0x7f3e03775da0>]
>>> plt.show()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/matplotlib/pyplot.py", line 252, in show
return _show(args, **kw)
File "/usr/local/lib/python3.4/dist-packages/itermplot/init.py", line 103, in show
figmanager.show()
File "/usr/local/lib/python3.4/dist-packages/itermplot/init.py", line 216, in show
imgcat(data.getbuffer())
File "/usr/local/lib/python3.4/dist-packages/itermplot/init.py", line 76, in imgcat
buf += linesb'\n' + csi + b'?25l' + csi + b'%dF' % lines + osc
TypeError: unsupported operand type(s) for %: 'bytes' and 'int'
Will it work in future?
If I'm not able to change the python code and set rcParams
in python.
Is there any way to change the figure size in terminal? like set environment variables?
Thanks for being so responsive and fixing issues! I just wanted to point out a potential documentation issue in the README.md
.
Test fails.
Note that it works if you use IPython (even 2!).
xxx@xxx:~$ echo $MPLBACKEND
module://itermplot
xxx@xxxx:~$ python
Python 2.7.5 (default, Jan 2 2014, 20:34:29)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2810, in plot
ax = gca()
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 707, in gca
ax = gcf().gca(**kwargs)
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 370, in gcf
return figure()
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 343, in figure
**kwargs)
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr1/opt/python2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr1/opt/python2.7/lib/python2.7/lib-tk/Tkinter.py", line 1745, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
>>>
Python 2.7.11 |Anaconda custom (64-bit)| (default, Jun 15 2016, 15:21:30)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import matplotlib.pyplot as plt
In [2]: plt.plot([1,2,3])
Out[2]: [<matplotlib.lines.Line2D at 0x7f4bfa9b9ad0>]
In [3]: plt.show()
# Success!
In the readme you say "have itermplot.py somewhere on your PTHONPATH." This can be accomplished by running "Python setup.py install" or "pip install ". All this really requires is the creation of a setup.py file.
Hi. I'm a big fan of the package. Every other plot I draw is a different color and does not include axes. Do you know how I can turn this feature off?
Thanks!
It's a very nice library that helps me to enhance my efficiency, but I think most people using matplotlib with python are working with ipython because it has the syntax highlight and the code complementation and many other benefits than normal python shell. So, I hope there will be an update to support ipython. Thanks.
The problem raised in issue #43 and that you fixed with PR #44 recently caused me problems. I encountered this error:
TypeError: print_png() got an unexpected keyword argument 'facecolor'
where matplotlib 3.7.1 was passing "facecolor" in as an kwargument and then complaining about it when itermplot gave it right back, which made me scratch my head a little, but I see the fix in PR #44 is simply to stop pasing kwargs down. It turns out that if you do not specify a version of itermplot to pypi, it will install what it seems to think the the most recent version, version 0.331. Indeed, if you ask pypi for the history of itermplot, it says the most recent version is 0.331 uploaded in June of 2018.
https://pypi.org/project/itermplot/#history
However, if you say "I want version 0.5," pypi will give it to you.
Since 0.331 is not compatible with the more recent versions of matplotlib, could you bump the release version on pypi / note the version incompatibility between 0.331 and matplotlib > 3.3 (when the API change took effect)?
I had a previous version of itermplot (0.20) installed under my py2 environment, which worked fine. Upgrading to or installing 0.321, however, fails under Python2 (2.7.14, Mac OS 10.12.6). Installing 0.321 under my Python3 environment works fine.
If Python2 support is deprecated then feel free to close this issue, but Readme.md still states (grudging) support for py2 :)
Here's the error. I don't have time to troubleshoot right now but I might be able to in the future.
Collecting itermplot
Using cached https://files.pythonhosted.org/packages/13/a6/10f9d43993d383aa289adb5b19f1e1448703fa8eec5edb75e1ebc34de909/itermplot-0.321.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/jq/sfgkbsys7kd6x00ds61hb2h46z5sy9/T/pip-install-eSstAT/itermplot/setup.py", line 7, in <module>
with open(path.join(here, 'README'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jq/sfgkbsys7kd6x00ds61hb2h46z5sy9/T/pip-install-eSstAT/itermplot/
https://github.com/hzeller/timg
They seem to use a different protocol that is supported by more terminals.
I want to use imshow to display a raw rgb picture, it seems that not support .
This looks like a nice library, but I cannot use it if there is no license:
github/choosealicense.com#196
I use conda, and love itermplot - but the version there is relatively old.
In order for matploblib to be usable again after uninstall, one must set the backend again. After pip uninstall itermplot
and removing $MPLBACKEND
, iPython still tries to use this backend. Running %pylab
once in the console fixes the problem. This should be at least documented.
Hi,
When I make a scatter plot in matplotlib, sometimes it renders and sometimes it doesn't. When I clip values (-1, 1) it fails, but when I clip to (-5, 5) I get to see the plot. I can't figure out why this is. When I savefig, everything works no matter what.
Thank you so much for this repo. It is amazing!
James
It appears that you need to set
export ITERMPLOT="rv"
Before the package will work at all.
See error output below (from trying to run the example in your README file):
/home/hue/bin/itermplot/itermplot.py in print_pdf(self, filename, **kwargs)
171 kwargs.setdefault('edgecolor', rcParams['savefig.edgecolor'])
172
--> 173 if 'rv' in os.getenv('ITERMPLOT'):
174 self.reverse()
175
TypeError: argument of type 'NoneType' is not iterable
This is after setting the
export PYTHONPATH=~/itermplot:$PYTHONPATH
export MPLBACKEND="module://itermplot"
First of all thanks for this awesome library. I really like being able to plot matplot graphs in iterm.
It's also great to be able to draw animations although I am experiencing some issues when trying to do so.
This is my current Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pip = "*"
install = "*"
itermplot = "==0.5"
networkx = "*"
matplotlib = "==3.3.1"
[requires]
python_version = "3.7"
With this dependencies I am trying to run this animation example but the animation doesn't seem to happen. I've only managed to create an animation effect with this code:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
from datetime import datetime
fig, ax = plt.subplots()
x = np.arange(0, 2*np.pi, 0.01)
line, = ax.plot(x, np.sin(x))
def animate(axes):
axes.set_title(datetime.now())
axes.figure.canvas.draw()
timer = fig.canvas.new_timer(interval=1000)
fig.canvas.timer = timer
timer.add_callback(animate, ax)
timer.start()
plt.show()
However to be able to run this code I had to set manually the matplotlib version to 3.3.1
(I just picked anything else than 3.4.2) because running the same code with the more recent version of matplotlib failed with the following error:
Traceback (most recent call last):
File "animate.py", line 21, in <module>
plt.show()
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/matplotlib/pyplot.py", line 378, in show
return _backend_mod.show(*args, **kwargs)
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/itermplot/__init__.py", line 140, in show
figmanager.show()
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/itermplot/__init__.py", line 295, in show
data = self.animate(loops, outfile)
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/itermplot/__init__.py", line 269, in animate
writer.grab_frame()
File "/Users/inigo.mediavilla/.pyenv/versions/3.7.7/lib/python3.7/contextlib.py", line 119, in __exit__
next(self.gen)
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/matplotlib/animation.py", line 238, in saving
self.finish()
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/matplotlib/animation.py", line 345, in finish
overridden_cleanup()
File "/Users/inigo.mediavilla/.local/share/virtualenvs/learn-draw-zC7riZv8/lib/python3.7/site-packages/itermplot/__init__.py", line 252, in cleanup
self._frame_sink().close()
AttributeError: 'ItermplotImageMagickWriter' object has no attribute '_frame_sink'
Are you aware of limitations with the more recent versions of matplotlib ?
Note: I'd be happy to come up with PRs to document the supported versions and maybe even fixes to that itermplot keeps working for them.
I get the following traceback in a jupyter console
session with the itermplot==0.5
version recommended in the readme. Using pip install --upgrade itermplot
to version 0.331 also does not help.
In [1]: fig, ax = plt.subplots()
...: fig.show()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [1], in <module>
1 fig, ax = pplt.subplot()
----> 2 fig.show()
File ~/miniconda3/lib/python3.9/site-packages/matplotlib/figure.py:2364, in Figure.show(self, warn)
2360 raise AttributeError(
2361 "Figure.show works only for figures managed by pyplot, "
2362 "normally created by pyplot.figure()")
2363 try:
-> 2364 self.canvas.manager.show()
2365 except NonGuiException as exc:
2366 if warn:
File ~/miniconda3/lib/python3.9/site-packages/itermplot/__init__.py:298, in ItermplotFigureManager.show(self)
295 data = self.animate(loops, outfile)
297 if hasattr(data, "getbuffer"):
--> 298 imgcat(data.getbuffer(), fn)
299 else: # Python 2
300 imgcat(data.getvalue(), fn)
File ~/miniconda3/lib/python3.9/site-packages/itermplot/__init__.py:124, in imgcat(data, fn)
122 sys.stdout.buffer.write(buf)
123 else:
--> 124 sys.stdout.write(buf)
125 sys.stdout.flush()
127 print()
File ~/miniconda3/lib/python3.9/site-packages/ipykernel/iostream.py:513, in OutStream.write(self, string)
503 """Write to current stream after encoding if necessary
504
505 Returns
(...)
509
510 """
512 if not isinstance(string, str):
--> 513 raise TypeError(
514 f"write() argument must be str, not {type(string)}"
515 )
517 if self.echo is not None:
518 try:
TypeError: write() argument must be str, not <class 'bytes'>
Drag and drop is great, just that the extension is missing, so it doesn't display automatically. Just renaming the file and adding the .pdf extension works fine.
I'm able to get things working fine when running the commands from within python, but when trying to run from my shell with python3 myScript.py
, the resulting graph pops up as a new window instead of within the terminal. Is there a way to get it to still graph within the terminal when running python scripts from bash?
Everything works as expected if I am not in tmux but when I use tmux itermplot doesn't work at all.
This project is super cool! & it works on TMUX (though the output seems to be very small), but it doesn't seem to work on GNU Screen.
Was wondering if that could be added. Thanks.
I'm seeing this error:
In [2]: import matplotlib.pyplot as plt
...: plt.plot([1,2,3,4])
...: plt.ylabel('some numbers')
...: plt.show()
...:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-a1c4f0c7307c> in <module>()
2 plt.plot([1,2,3,4])
3 plt.ylabel('some numbers')
----> 4 plt.show()
/home/hue/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in show(*args, **kw)
242 """
243 global _show
--> 244 return _show(*args, **kw)
245
246
/home/hue/bin/itermplot/itermplot.pyc in show()
93 figmanager = Gcf.get_active()
94 if figmanager is not None:
---> 95 figmanager.show()
96 else:
97 for manager in Gcf.get_all_fig_managers():
/home/hue/bin/itermplot/itermplot.pyc in show(self)
205 data = io.BytesIO()
206 self.canvas.print_figure(data, facecolor='none',
--> 207 edgecolor='none', transparent=True)
208 imgcat(data.getbuffer())
209
/home/hue/anaconda2/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2230 orientation=orientation,
2231 bbox_inches_restore=_bbox_inches_restore,
-> 2232 **kwargs)
2233 finally:
2234 if bbox_inches and restore_bbox:
/home/hue/bin/itermplot/itermplot.pyc in print_pdf(self, filename, **kwargs)
172
173 if 'rv' in os.getenv('ITERMPLOT'):
--> 174 self.reverse()
175
176 image_dpi = kwargs.get('dpi', 72) # dpi to use for images
/home/hue/bin/itermplot/itermplot.pyc in reverse(self, **kwargs)
147 for obj in self.figure.findobj():
148 if not obj in seen:
--> 149 modify(obj)
150 seen.add(obj)
151
/home/hue/bin/itermplot/itermplot.pyc in modify(c)
140 if not fcset:
141 c = obj.get_color()
--> 142 obj.set_color(revvideo(c))
143 except AttributeError as e:
144 pass
/home/hue/bin/itermplot/itermplot.pyc in revvideo(x)
57 return np.array([rev(el) for el in x])
58 else:
---> 59 return rev(x)
60
61 def imgcat(data, lines=-1):
/home/hue/bin/itermplot/itermplot.pyc in rev(c)
48 return (1.0 - r, 1.0 - g, 1.0 - b, a)
49 else:
---> 50 r, g, b = c
51 return (1.0 - r, 1.0 - g, 1.0 - b, 1.0)
52
ValueError: need more than 1 value to unpack
Hi, many thanks for providing this very useful plugin.
I got this to work in iterm2. But it would not show a plot when I am using it in terminal mode in neovim. Is there any a priori reason why this would not work?
Many thanks
I've been trying to work around #33 by styling the background of the axes, but I now see that the figure is being forced to be transparent. It would be nice if there was a way to disable that.
More generally: Would it be feasible/sensible to use stylesheets instead of reversing the video? I.e, have an environment variable that takes a stylesheet name and overrides the colours based on that?
Hello,
Thanks for sharing this tool.
I am running on MacOS 10.2 Sierra with anaconda python 3.5.
I also have XQuartz installed.
I set the environment variables correctly and have the latest version of the script.
When I try to run test.py or a simple plot in ipython, i just get a blank space and no display.
I was wondering if you have any suggestions
In [2]: plt.plot([1, 2, 3])
Out[2]: [<matplotlib.lines.Line2D at 0x10cd55b00>]
In [3]: plt.show()
In [4]:
Thanks!
When ITERMPLOT_FRAMES is not defined, script works as expected:
$ env | grep MPLBACKEND
MPLBACKEND=module://itermplot
$ env | grep ITERMPLOT_FRAMES
$ python docs/simple.py
However, if ITERMPLOT_FRAMES is defined, script without animation crashes:
$ ITERMPLOT_FRAMES=1 python docs/simple.py
Traceback (most recent call last):
File "docs/simple.py", line 3, in <module>
plt.show()
File "/Users/admin/anaconda/envs/py3k/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show
return _show(*args, **kw)
File "/Users/admin/code/itermplot/itermplot/__init__.py", line 119, in show
figmanager.show()
File "/Users/admin/code/itermplot/itermplot/__init__.py", line 250, in show
data = self.animate(loops, outfile)
File "/Users/admin/code/itermplot/itermplot/__init__.py", line 228, in animate
self.canvas.timer._on_timer()
AttributeError: 'FigureCanvasItermplot' object has no attribute 'timer'
The problem is when ITERMPLOT_FRAMES is defined itermplot expects the animation module to call new_timer to initialise the timer before calling show. For scripts that don't have animation, the timer was never initialized.
itermplot should work as no ITERMPLOT_FRAMES is set when the script does not call animation.
This is awesome. Do you have plans for integrating this into matplotlib? Something like this should become an official backend.
On a related note, I don't see any license file in your repository. Could you please add one so it is clear under what conditions people can reuse your code and submit patches?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.