命令行中画图
利用 item2客户端, ssh远程到服务器中,竟然能画图
- 例子1
imgcat fig.jpg
- 例子2
export GNUTERM=png
gnuplot -e "plot [-10:10] sin(x)" | imgcat
- 例子3
python -c 'from pylab import *; x= linspace(-10,10,100); plot(x,sin(x)); show()'
- 例子4
imgcat <- function(plot_command){
fn <- tempfile(pattern = "file", tmpdir = tempdir(), fileext = ".png")
png(fn)
eval(quote(plot_command))
dev.off()
system2("imgcat", fn)
}
x = (-100:100)/10
imgcat(plot( x, sin(x ), type='l' ))
library(ggplot2)
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species))
imgcat(print(p))
配置说明
pip install itermplot
sed -i "s/facecolor='none'/facecolor='white'/g; s/transparent=True/transparent=False/g" /opt/anaconda3/lib/python3.6/site-packages/itermplot/__init__.py
facecolor='white'
echo 'export MPLBACKEND="module://itermplot" ' >>~/.bashrc