使用spmap时删除连接点的线

时间:2019-02-05 15:38:24

标签: stata

我有一个数据文件,其中包含550个数据观察值,另一个数据文件包含我想绘制为点的550个唯一坐标。

我能够使用以下 community-contributed 命令成功生成地图:

use izmir_sample_data, clear
spmap using izmir_coor, point(data("izmir_coor") xcoord(_X) ycoord(_Y) size(small)) id(id) 

我不希望如图所示通过线连接点:

enter image description here

以下是“ izmir_sample_data”文件中的示例数据:

district_n  neighborho     f_lat_       f_lon_  treat_scri  id
Aliaga  Asagisakran mah     38.923206   27.096613   1        1
Aliaga  Ataturk mah         38.796993   26.965206   0        2
Aliaga  Bahcedere mah       38.9034     27.112288   0        3
Aliaga  Bhayrettin Pasa mah 38.701733   27.019375   0        4
Aliaga  Bozkoy mah         38.720249    26.964622   0        5
Aliaga  Cakmakli mah       38.746994    26.911827   0        6
Aliaga  Caltilidere mah    38.853058    27.036352   0        7
Aliaga  Citak mah           38.75761    27.058191   0        8
Aliaga  Fatih mah          38.702007    26.998039   0        9

以下是“ izmir_coor”文件中的示例数据:

_ID    _X           _Y
1   27.096613   38.923206
2   26.965206   38.796993
3   27.112288   38.9034
4   27.019375   38.701733
5   26.964622   38.720249
6   26.911827   38.746994
7   27.036352   38.853058
8   27.058191   38.75761
9   26.998039   38.702007

如何解决此问题?

1 个答案:

答案 0 :(得分:2)

以下内容重复了您的问题:

clear
input str50 district_n str50 neighborho f_lat_ f_lon_ treat_scri id
"Aliaga"  "Asagisakran mah"     38.923206   27.096613   1        1
"Aliaga"  "Ataturk mah"         38.796993   26.965206   0        2
"Aliaga"  "Bahcedere mah"       38.9034     27.112288   0        3
"Aliaga"  "Bhayrettin Pasa mah" 38.701733   27.019375   0        4
"Aliaga"  "Bozkoy mah"         38.720249    26.964622   0        5
"Aliaga"  "Cakmakli mah"       38.746994    26.911827   0        6
"Aliaga"  "Caltilidere mah"    38.853058    27.036352   0        7
"Aliaga"  "Citak mah"           38.75761    27.058191   0        8
"Aliaga"  "Fatih mah"          38.702007    26.998039   0        9
end

save izmir_sample_data, replace

clear 
input _ID _X _Y
1   27.096613   38.923206
2   26.965206   38.796993
3   27.112288   38.9034
4   27.019375   38.701733
5   26.964622   38.720249
6   26.911827   38.746994
7   27.036352   38.853058
8   27.058191   38.75761
9   26.998039   38.702007
end

generate obs = _n
sort _ID obs
drop obs
save izmir_coor, replace

use izmir_sample_data, clear
spmap using izmir_coor, point(data("izmir_coor") xcoord(_X) ycoord(_Y) size(small)) id(id)

enter image description here

要解决此问题,只需使用ocolor(none)选项:

spmap using izmir_coor, point(data("izmir_coor") xcoord(_X) ycoord(_Y) size(small)) ///
                        ocolor(none) id(id)

enter image description here