COLOR(red){SIZE(20){グラフィックス参考実例集:プロット点のタイプ}}

([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックスパラメータ]]を参照する。)~

plot(), points() 等のグラフィックス関数による点の形状はオプション COLOR(red){pch=n}、もしくは COLOR(red){pch="シンボル文字"} で指定される。以下はそのサンプルである。

COLOR(blue){注}: pch="." (ピリオッド文字)はCOLOR(red){真正のドット}(指定位置にちょうど置かれる1ピクセルの点)で、文字拡大率に影響されない。これはドットをつなげて曲線を描く等に使うため、他の文字記号指定とはことなり、特別な仕様になっているらしい。~

COLOR(blue){ある方からのコメント:「pch=0 は pch=22 と同じ。」} 実は奇妙なことに COLOR(red){pch=""} も pch=22 と同じになります(ほとんどバグ?)。pch=21 は pch=1 と同じに見えますね(他にも同じようなシンボルがいくつか)。 更に COLOR(red){pch=n} (n=-1,-2,...) は pch=1 と同じになります。n=33,...,126 は半角 alphanumeric、そして n=161,...,255 あたりではエキゾチックな文字がでてきますよ。

#ref(pch0.png)
#ref(pch1.png)
#ref(pch2.png)
#ref(pch3.png)
#ref(pch4.png)
#ref(pch5.png)
#ref(pch6.png)
#ref(pch7.png)

* 実際のところ
* 実際のところ [#he7b2d1c]
pchは0〜25まで定義されているドットは特殊な処理を施している。0,22は
気持ち違う程度。
32(0x20)〜255(0xff)はそのフォントの文字(1byte)が出てくる。
デフォルトのpchは1である。
pch=NULLはデフォルトの1が割り当てられるが,
pch=""は0とみなされる。ちなみに0と22では22の方が若干小さい矩形である。
| pch | 形状 |
| 0| S square |
| 1| S octahedron ( circle) |
| 2| S triangle - point up |
| 3| S plus |
| 4| S times |
| 5| S diamond |
| 6| S triangle - point down |
| 7| S square and times superimposed |
| 8| S plus and times superimposed |
| 9| S diamond and plus superimposed |
| 10| S hexagon (circle) and plus superimposed |
| 11| S superimposed triangles |
| 12| S square and plus superimposed |
| 13| S octagon (circle) and times superimposed |
| 14| S square and point-up triangle superimposed |
| 15| S filled square |
| 16| S filled octagon (circle) |
| 17| S filled point-up triangle |
| 18| S filled diamond |
| 19| R filled circle |
| 20| R `Dot' (small circle) |
| 21| circles |
| 22| squares |
| 23| diamonds |
| 24| triangle (point up) |
| 25| triangle (point down) |

-「n=33,...,126 は半角アルファベット」というのは単に10進ASCIIコードを指定しているのでは?[[ASCIIコード表:http://www9.plala.or.jp/sgwr-t/c_sub/ascii.html]] --  &new{2004-09-22 (水) 10:25:45};
-Hmisc package 内の show.pch() が便利です。 -- [[さら]] &new{2006-03-03 (金) 03:06:46};
-海の向うではpchが足りないと騒いでいるが,日本語なら漢字も使えます.(^-^v -- [[なかま]] &new{2006-03-03 (金) 08:29:28};
- pch=0とpch=22の違いは中を塗りつぶせるかの違い。グラフィックス参考実例集:凡例9みたいに中を塗りつぶすためには21から25でなくてはならない。 -- [[Mead]] &new{2010-03-03 (水) 00:30:40};

#comment

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS