- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 14446 个
- 通用积分
- 1962.3850
- 学术水平
- 1119 点
- 热心指数
- 1167 点
- 信用等级
- 1061 点
- 经验
- 8523 点
- 帖子
- 1629
- 精华
- 1
- 在线时间
- 2492 小时
- 注册时间
- 2010-10-10
- 最后登录
- 2025-12-19
已卖:1980份资源
学科带头人
还不是VIP/贵宾
- 威望
- 0 级
- 论坛币
 - 14446 个
- 通用积分
- 1962.3850
- 学术水平
- 1119 点
- 热心指数
- 1167 点
- 信用等级
- 1061 点
- 经验
- 8523 点
- 帖子
- 1629
- 精华
- 1
- 在线时间
- 2492 小时
- 注册时间
- 2010-10-10
- 最后登录
- 2025-12-19
 | 开心 2025-9-24 13:52:14 |
|---|
签到天数: 344 天 连续签到: 1 天 [LV.8]以坛为家I
|
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
- //在图像中添加背景
- //转化地址: http://www.text-image.com/convert/ascii.html
- //set width to 500 转化时特别注意的地方
- // 下载后保存到当前工作路径(输入cd/pwd),本例命名为car ascii to text big.txt
- set more off
- infix str1 a1-a500 1-500 using "car ascii to text big.txt", clear
- //hexdump may be needed to look for unexpected characters
- //hexdump "D:\StataMP\ado\personal\data\car ascii to text big.txt", tabulate
- //scaling y axis picture data and reversing
- generate y=90+((_N-_n+1)*1)
- reshape long a, i(y) j(col)
- //replacing characters with numbers
- replace a="1" if a=="+"
- replace a="2" if a=="-"
- replace a="3" if a=="."
- replace a="4" if a=="/"
- replace a="5" if a==":"
- replace a="6" if a=="-"
- replace a="7" if a=="M"
- replace a="8" if a=="N"
- replace a="9" if a=="`"
- replace a="10" if a=="d"
- replace a="11" if a=="h"
- replace a="12" if a=="m"
- replace a="13" if a=="o"
- replace a="14" if a=="s"
- replace a="15" if a=="y"
- //scaling x axis picture data
- replace col=col/10
- merge 1:1 _n using "D:\StataMP\ado\base/a/auto.dta" //<--------根据需要改变
- local size="tiny"
- twoway ///
- (scatter y col if a=="1" ,msymbol(circle) ///
- mcolor("0 0 0*.20") msize(`size') ) ///
- (scatter y col if a=="2" ,msymbol(circle) ///
- mcolor("255 255 255*.2") msize(`size')) ///
- (scatter y col if a=="3" ,msymbol(circle) ///
- mcolor("255 0 0*.2") msize(`size') ) ///
- (scatter y col if a=="4" ,msymbol(circle) ///
- mcolor("0 0 255*.2") msize(`size') ) ///
- (scatter y col if a=="5" ,msymbol(circle) ///
- mcolor("0 0 255*.2") msize(`size') ) ///
- (scatter y col if a=="6" ,msymbol(circle) ///
- mcolor("255 255 0*.2") msize(`size') ) ///
- (scatter y col if a=="7" ,msymbol(circle) ///
- mcolor("0 255 255*.2") msize(`size') ) ///
- (scatter y col if a=="8" ,msymbol(circle) ///
- mcolor("255 0 255*.2") msize(`size') ) ///
- (scatter y col if a=="9" ,msymbol(circle) ///
- mcolor(white) msize(`size') ) ///
- (scatter y col if a=="10",msymbol(circle) ///
- mcolor(orange*.2) msize(`size') ) ///
- (scatter y col if a=="11",msymbol(circle) ///
- mcolor(brown*.2) msize(`size') ) ///
- (scatter y col if a=="12",msymbol(circle) ///
- mcolor(sand*.2) msize(`size') ) ///
- (scatter y col if a=="13",msymbol(circle) ///
- mcolor(black*.2) msize(`size') ) ///
- (scatter y col if a=="14",msymbol(circle) ///
- mcolor(black*.2) msize(`size') ) ///
- (scatter y col if a=="15",msymbol(circle) ///
- mcolor(black*.2) msize(`size') ) ///
- (scatter length mpg) ///
- (lfit length mpg) ///
- ,yscale( range(100 250)) ///
- ytitle(Length ins.) xtitle(mpg) ///
- title(Mpg v Length) legend(off)
- exit
复制代码 1.将照片上传,图片转化文本网址: http://www.text-image.com/convert/ascii.html
2.转换设置(参考)如下图:
点击convert--->result窗口复制保存为car ascii to text big.txt---->保存至当前工作路径(命令窗口输入pwd/cd)
3.运行上述代码 |
| - //下载GIMP软件(与PS类似)
- clear all
- set more off
- program hex
- syntax varname , Newv(name)
- generate `newv'=((strpos("`=c(alpha)'",`varlist')-1)/2)+10
- replace `newv'=real(`varlist') if `newv'==9.5
- end
- //values that can be changed
- local divide=20 //--------->此处调大,可以缩短时间
- insheet using "d:\StataMP\ado\personal\data\fastcar.html", clear //------>根据需要改变
- generate row=.
- replace row=1 if strpos(v1,"<TR>")
- replace row=sum(row)
- keep if strpos(v1, "<TD BGCOLOR") //------>此处进行了修改
- split v1,p(#)
- split v12,p(>)
- keep row v121
- generate obs=_n
- bysort row (obs):gen col=_n
- rename v121 hex
- generate hex1=substr(hex,1,1)
- generate hex1a=substr(hex,2,1)
- generate hex2=substr(hex,3,1)
- generate hex2a=substr(hex,4,1)
- generate hex3=substr(hex,5,1)
- generate hex3a=substr(hex,6,1)
- hex hex1, newv(dec1)
- hex hex1a, newv(dec1a)
- hex hex2, newv(dec2)
- hex hex2a, newv(dec2a)
- hex hex3, newv(dec3)
- hex hex3a, newv(dec3a)
- generate dec1b=16*dec1+dec1a
- generate dec2b=16*dec2+dec2a
- generate dec3b=16*dec3+dec3a
- keep dec1b dec2b dec3b row col
- generate dec1c=floor(dec1b/`divide')*`divide'
- generate dec2c=floor(dec2b/`divide')*`divide'
- generate dec3c=floor(dec3b/`divide')*`divide'
- gen str20 color=char(34)+string(dec1c,"%3.0f")+" "+string(dec2c,"%3.0f") ///
- +" "+string(dec3c,"%3.0f")+char(34)
- egen group_col=group(color)
- compress
- save pict_graph, replace
- use pict_graph, clear
- quiet summarize col
- local size="*`=33/`r(max)''" //marker size, can be adjusted
- levelsof color, local(a)
- merge 1:1 _n using "d:\StataMP\ado\base\a\auto.dta" //-------->根据需要改变
- summarize length
- gen y=90+(((_N-_n+1)-90))/(_N/r(max))
- //scaling x axis picture data
- replace col=col/9
- local z=1
- foreach i of local a {
- if `z'==1 {
- local zz = ///
- `"(scatter y col if group_col==`z',msymbol(square) mcolor(`i') msize(`size'))"'
- local z=2
- }
- else {
- local zz1 = ///
- `"(scatter y col if group_col==`z' ,msymbol(square) mcolor(`i') msize(`size'))"'
- local zz "`zz' `zz1'"
- local ++z
- }
- }
- twoway `zz' ///
- (scatter length mpg, mcolor(red) msize(large)) ///
- (lfit length mpg) ///
- ,yscale( range(100 325)) ///
- ytitle(Length ins.) xtitle(mpg) ///
- title(Mpg v Length) legend(off)
复制代码 1.下载GIMP,打开照片
2.文件-->Export as-->保存为fastcar.html,导出设置(参考)如下-->将该文件移至当前工作路径(命令窗口输入pwd/cd)
3.运行上述代码 |
|
|
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|
|
-
总评分: 经验 + 100
论坛币 + 100
学术水平 + 5
热心指数 + 5
信用等级 + 5
查看全部评分
|