eps格式
set term postscript enhanced color solid
set output 'xxx.eps'
png格式
set terminal png #size 400,300 enhanced font "Helvetica,20"
set output 'xxx.png'
pdf格式
set terminal postscript
set output 'xxx.pdf'
- 谈谈gnuplot(十):输出 pdf 和 png 图片
- 谈谈gnuplot :输出 pdf 和 png 图片
- Gnuplot从python发送换行符和",\“
- 从python调用gnuplot
- gnuplot绘制图像并保存
- python自动化写gnuplot脚本
import os
xvg_files = [file for file in os.listdir('.') if file.endswith('.xvg')]
xvg_dict = {}
for filename in xvg_files:
if filename.endswith('_Motif.xvg'):
key = filename.replace('_Motif.xvg', '.xvg')
xvg_dict[key] = filename
gnuplot_script="""
set term postscript enhanced color solid
set output 'xxx.eps'
set yr [0:1]
set xlabel "Time(ns)" font "Times-Roman,24"
set ylabel "RMSD(nm)" font "Times-Roman,24"
set mxtics 2
set mytics 2
set bmargin 4
set size square
"""
for key, value in xvg_dict.items():
gnuplot_script += f'plot "{key}" u 1:2 w lp lt 1 pt 7 ps 0.5 lc rgb "red",\\\n\
"{value}" u 1:2 w lp lt 1 pt 7 ps 0.5 lc rgb "blue"\n'
with open('rmsd01.gnu', 'w') as f:
f.write(gnuplot_script)