2017-12-12 5 views
0

犯罪の数字を示すlondonのマップを作成しました。あなたが私のイメージから見ることができるように、私の伝説は厄介な場所にあります - 私はそれが左または右下にあることを好むでしょうか?誰も私がこれをどうやってやれるか知っている。マップを作成したコードは次のとおりです。tmapパッケージでqtm()を使用して凡例の位置を変更する方法

また、マップのタイトルを作成するにはどうすればよいですか?既に凡例のタイトルを作成しています。

マップと凡例

enter image description here

qtm(brgh, fill = "Theft15", fill.title="Number of recorded thefts") 

答えて

1

私はあなたのデータを持っていないので、私は次のデモンストレーションのためにtmapパッケージからのデータを使用することにしました。キーポイントはtm_legend()を使用することです。現在のCRANマニュアルを調べると、tm_layout()セクションに詳細があります。凡例の位置はlegend.positionを使用してtm_legend()に指定できます。メインタイトルの場合は、関数内でmain.titlemain.title.positionを使用できます。

library(tmap) 

data(World, rivers, metro) 

qtm(shp = World, fill = "economy", format = "World", style = "col_blind") + 
tm_legend(legend.position = c("left", "top"), 
      main.title = "My title", 
      main.title.position = "right") 

enter image description here

qtm(shp = World, fill = "economy", format = "World", style = "col_blind") + 
tm_legend(legend.position = c("left", "bottom"), 
      main.title = "My title", 
      main.title.position = "right") 

enter image description here

関連する問題