Code
include("utils.jl")
[ Info: loading success
load pacakge
include("utils.jl")
[ Info: loading success
=@pipe CSV.File("./data/technology-adoption-by-households-in-the-united-states.csv")|>DataFrame|>rename(_,"Technology Diffusion (Comin and Hobijn (2004) and others)"=>:Tech_Diffusion)|>select(_,Not(:Code))
df
# gdf=groupby(df,:Entity)
# cats= @pipe keys(gdf) .|> values(_)[1]
=@chain df begin
gdf@group_by(Entity)
@arrange(Year)
@ungroup
@group_by(Entity)
end
= @pipe keys(gdf) .|> values(_)[1]
cats=keys(gdf)|>length; group_size
=[]
axs=Figure(resolution=(1200,2000))
figfunction plot_diffusion(df,ax,title,c)
=title
ax.title=([1900,1930,1960,1980,2019],["1900","30","60","80","2019"])
ax.xticks=([0,50,100],["0%","50%","100%"])
ax.yticks= c==1 ? true : false
ax.yticklabelsvisible=df.Year,df.Tech_Diffusion
xs,yslines!(ax,xs,ys,color=(:red,0.8))
end
for idx in 1:45
=fldmod1(idx,4)
r,c=Axis(fig[r,c])
axpush!(axs,ax)
=gdf[idx]
df=cats[idx]
titleplot_diffusion(df,ax,title,c)
end
linkyaxes!(axs...)
linkxaxes!(axs...)
fig