1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gnuplotの点の透過

Last updated at Posted at 2019-10-19

gnuplot 5.0以上でできる

データの用意

gnuplot> set samp 2000

ランダムな点を2000個用意する

デフォルト

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0))

目を背けたくなるくらい、汚い

丸点+サイズ+色

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)) ps 1.5 pt 7 lc 3

ptpointtypeの指定 (7で太丸)
pspointsizeの指定
lclinecolorの指定 (color indexで指定。3で水色)

RGB値で色を指定

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)) ps 1.5 pt 7 lc rgb 0x0088FF

ARGB値で透過+色指定

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)) ps 1.5 pt 7 lc rgb 0xAA0088FF

tc(=texecolor)はARGBは不可らしい
ちなみに、下記のようにu(=using)の中に色指定を描いてもOK

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)):(0xAA0088FF) ps 1.5 pt 7 lc rgb variable

pdfでの出力

cairographicのエンジンを使ったpdfcairoで出力すると吉
termの指定は、

gnuplot> set terminal pdfcairo color enhanced font "Helvetica,18"

です。

なお、postscriptはARGBを扱えないらしい。
LATEXに流すときも、epsではなくてpdfでやったほうが良い模様

参考:
gnuplot で pdf が出力されない時: 最後にunset outputを指定する

おまけ1

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)):(rand(0)*2):(0xAA0088FF) ps variable pt 7 lc rgb variable

usingの三項目でpsに乱数(0~2)を入れている

おまけ2

gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)):(rand(0)*2):(rand(0)*64):(0xAA0088FF) ps variable pt variable lc rgb variable

usingの四項目でptに乱数(0~63)を入れている
(pointtypeは0~63の64種類がある)

おまけ3

gnuplot> argb(a,r,g,b)=256*256*256*a+256*256*r+256*g+b
gnuplot> p [-0.25:1.25][-0.25:1.25] '+' u (rand(0)):(rand(0)):(rand(0)*2):(rand(0)*64):(argb(rand(0)*256,rand(0)*256,rand(0)*256,rand(0)*256)) ps variable pt variable lc rgb variable notitle

argb(a,r,g,b)という関数で0xAARRGGBB形式を10進数に直して、usingの第五項で乱数(0~256)を入れている。
notitleで、タイトルを消した。

キラキラ〜

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?