Hello everyone,
When I run the code below (search labutil and install), I get the result shown in Figure 1.

However, when I run a similar piece of code, I get the result shown in Figure 2.

I would like the final figure to look like Figure 1, but with the x-axis label as "企业数字化水平" instead of the shorter "企业数字化" (which might be the reason why the figure appears incorrectly).
Could anyone help me resolve this issue?
Thanks in advance!
When I run the code below (search labutil and install), I get the result shown in Figure 1.
Code:
* 清除当前数据 clear * 输入示例数据 input str20(y x markers) "企业跨区交易" "电子商务发展" "[1]tly25jjyj" "贸易成本" "电子商务发展" "[2]jzs20jjyj" "居民消费" "电子商务发展" "[3]ws25syjjyj" "企业跨区交易" "企业数字化" "[4]yzc23cjyj" "贸易成本" "统一大市场" "[5]hsy24zgsl" "居民消费" "数字经济发展" "[6]bcw24dysj" end * 创建 X 轴标签,利用宏实现换行 local linebreak = char(10) label define X 1 "电子商务发展" 3 "企业数字化" 5 "统一大市场" 7 "数字经济发展" encode x, gen(X) * 创建 Y 轴标签 encode y, gen(Y) labmask Y, values(y) * 绘制散点图 scatter Y X, /// ytitle("") /// xtitle("") /// mcolor(none) /// mlab(markers) /// mlabpos(0) /// mlabsize(small) /// xlab(1 2 " " 3 4 " " 5 6 " " 7 8 " ", val labsize(small) grid) /// xsc(r(0 9)) /// ylab(1(1)3, val labsize(small) grid angle(0)) /// ysc(r(0.5 3.5) outergap(1)) /// scale(0.75) * 导出图形为 PNG 文件 graph export "HW1Answer.png", as(png) name("Graph") replace
However, when I run a similar piece of code, I get the result shown in Figure 2.
Code:
* 清除当前数据 clear * 输入示例数据 input str20(y x markers) "企业跨区交易" "电子商务发展" "[1]tly25jjyj" "贸易成本" "电子商务发展" "[2]jzs20jjyj" "居民消费" "电子商务发展" "[3]ws25syjjyj" "企业跨区交易" "企业数字化水平" "[4]yzc23cjyj" "贸易成本" "统一大市场" "[5]hsy24zgsl" "居民消费" "数字经济发展" "[6]bcw24dysj" end * 创建 X 轴标签,利用宏实现换行 local linebreak = char(10) label define X 1 "电子商务发展" 3 "企业数字化水平" 5 "统一大市场" 7 "数字经济发展" encode x, gen(X) * 创建 Y 轴标签 encode y, gen(Y) labmask Y, values(y) * 绘制散点图 scatter Y X, /// ytitle("") /// xtitle("") /// mcolor(none) /// mlab(markers) /// mlabpos(0) /// mlabsize(small) /// xlab(1 2 " " 3 4 " " 5 6 " " 7 8 " ", val labsize(small) grid) /// xsc(r(0 9)) /// ylab(1(1)3, val labsize(small) grid angle(0)) /// ysc(r(0.5 3.5) outergap(1)) /// scale(0.75) * 导出图形为 PNG 文件 graph export "HW1Answer.png", as(png) name("Graph") replace
I would like the final figure to look like Figure 1, but with the x-axis label as "企业数字化水平" instead of the shorter "企业数字化" (which might be the reason why the figure appears incorrectly).
Could anyone help me resolve this issue?
Thanks in advance!
Comment