LoginSignup
0
0

More than 1 year has passed since last update.

gnuplotでepsとemfを同時に作ろうぜ

Posted at

はじめに

texに挿入するために,gnuplotでepsファイルを作成する事があるかと思います.
このepsをパワポで使うとき,どうしますか?オススメは,emfファイルでパワポに挿入することです.(理由は,ググってみて下さい)

どうすればいいのか.今まではInkscapeのコマンドラインを使い,batファイルにて処理していました.

しかし,この度直接emfを作成できそうになったので,ここに共有します.

emf を作るには

gnuplotにて,以下を最後に挿入すればおkです.

emfを作成するためのスクリプト
# 予めepsを出力するスクリプトがあり,出力し終えた上で,以下.
set term emf monochrome font "Times New Roman,24" enhanced lw 2
set output "output_sample.emf"
replot
set output
Italicを使うには
/TimesNewRoman-Italic
ではなく,
{/Times:Italic}
を使う

上記2点がミソでした.

実際にやってみる

用意したデータはこちら
ex.tsvと名付けています.

image.png

ex.plt
reset
set terminal postscript eps enhanced color "TimesNewRoman" 28
set output "ex.eps"
set xlabel "velocity, {/Times:Italic v} (m/sec^{-1})" 
set ylabel "hoge, {/Times:Italic y } (%)"
set rmargin 5 # 10^-4が見切れていたため

stats "ex.tsv" u "a":"b"
R = sprintf("{/Times:Italic r} = %.3f", STATS_correlation )
set label R at graph 0.05,0.9 font "Times,40"

# 以下はemfではできていない(22:40 2022/12/21現在は)
set label "{/Symbol \264 }10^{-4}" at graph 1.0, -0.15

plot "ex.tsv" every ::1 u 1:2 with points lc "cyan" pt 7 ps 1.5 notitle

set term emf font "Times New Roman,24" enhanced lw 2
set output "ex.emf"
replot
set output

そんでできたのがコレ
右:eps
左:emf
同じディレクトリにemfが出力されます.
image.png

このフォントのズレをどう捉えるか,ですが,今のところ自分は問題なく捉えています.
軸ラベル名のフォントのズレなどは,パワポに貼るときには上から修正してやればいいだけのこと.それよりプロットやxtics, yticsあたりが重要なんだわさ.

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0