zoukankan      html  css  js  c++  java
  • 命令行中画图

    利用 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
    
  • 相关阅读:
    2020 11 21
    2020 11 20
    2020 11 19
    2020 11 18
    2020 11 17
    2020 11 16
    2020 11 15
    2020 11 14
    2020 11 14
    第五周学习进度报告
  • 原文地址:https://www.cnblogs.com/bregman/p/6607270.html
Copyright © 2011-2022 走看看