Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ceo LTS, test second y axis #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .bead-meta/bead
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"inputs": {
"ceo-panel": {
"content_id": "9090d142a7b39842acf6d7b6d3ead47cb66d1abefe987fd7db304d0e1c0951f310f9d258b60a717c25b65d0902a734d28fe80284d143c2801ffa6dac576af8bd",
"freeze_time": "20240321T161733989845+0100",
"content_id": "6b2be3381ea673cdb46e1ce7fff99f8b4647ac8d5093b2ff37bfd2969dfae1b43cb558fc813ba80ab494884e2b38e6152d5e7b9d897d6480a95768f6667a3746",
"freeze_time": "20241014T223447293736+0200",
"kind": "8f68500668824a7b8b9486f034a6aded-e7db5a61-97b7-4d28-8e22-3ed70eade94b"
},
"merleg-LTS-2022": {
"content_id": "a7319547162af9f3eb71dbe4824f40dcee7dab3a0eabfc6e126cd2076e48a7a08fc5c1a37f39ce61d4b4bf930021015210e8f95f8282acb5c71b66fc7ce3113c",
"freeze_time": "20230404T105822748178+0200",
"kind": "cc1cea3c692711e25b89bc9fa2ef25ce-f25508ec-b661-46db-8b06-76f91471464f"
"merleg-LTS-2023": {
"content_id": "80c0aac26a582bab8ddcffce75902c68d5902ceee6f1aed41a407095cf1657caeee89ad265bde77875deb6ff7fdeaf40123fa40ad21645c9b0303aee1784c748",
"freeze_time": "20240913T134437850009+0200",
"kind": "dd1549031b41346f51108b1e8345cb30-e1a8ffea-2d02-4d4e-93d8-5dbc50684081"
}
},
"kind": "cc15319c5e76f932415ce513f79405b8-7788b0f9-89c3-494c-a79a-d90f1e5f1795"
Expand Down
Binary file modified output/fig/age2013.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed output/fig/age2021.png
Binary file not shown.
Binary file added output/fig/age2022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/fig/mean_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/fig/n_firms_cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/fig/older60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,32 @@ function ts_plot(df::AbstractDataFrame, y::Symbol, t::Symbol = :year, ytickforma
save("$(figure_folder)/$(y).png", fig, px_per_unit = 1)
end

function ts_plot_cat(df::AbstractDataFrame, y::Symbol, t::Symbol = :year, ytickformatvar::String = :"{:.0f}", xticksvar::StepRange = :1980:2:2022)
axis = (width = 1000, height = 600,
ytickformat = ytickformatvar,
xtickwidth = 1,
xminorticksvisible = true,
xminorgridvisible = true,
xgridvisible = true,
xtickformat = "{:.0f}",
xticks = xticksvar)
axis2 = (width = 1000, height = 600,
ytickformat = ytickformatvar,
xtickwidth = 1,
xminorticksvisible = true,
xminorgridvisible = true,
xgridvisible = true,
xtickformat = "{:.0f}",
xticks = xticksvar)
layer_1 = data(df) * mapping(t, y, color = :category, layout = :category_1) * visual(Lines, linewidth = 4)
paginated_1 = paginate(layer_1)
figuregrids = draw(paginated_1; axis = axis)
layer_2 = data(df) * mapping(t, y, color = :category, layout = :category_2) * visual(Lines, linewidth = 4)
paginated_2 = paginate(layer_2)
fig = draw(paginated_2, 1, axis = axis2)
save("$(figure_folder)/$(y).png", fig, px_per_unit = 1)
end

function histogram(df::AbstractDataFrame, y::Symbol, weight::Symbol = :n_ceos)
axis = (width = 1000, height = 600,
ytickformat = "{:.0f}",
Expand Down
17 changes: 13 additions & 4 deletions src/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ function main()
@collapse n_ceos = rowcount(age), by(age, gender)
@rename age age2013
end
byagepyr21 = @with ceos begin
@keep @if year == 2021
byagepyr22 = @with ceos begin
@keep @if year == 2022
@collapse n_ceos = rowcount(age), by(age, gender)
@rename age age2021
@rename age age2022
end
bycat = @with all begin
@generate category_1 = category
@replace category_1 = "" @if (category_1 == "micro domestic")
@generate category_2 = ""
@replace category_2 = category @if (category == "micro domestic")
@collapse n_firms_cat = sum(n_firms), by(category, category_1, category_2, year)
@sort category category_1 category_2 year
end

set_aog_theme!()
Expand All @@ -59,8 +67,9 @@ function main()
fig8 = ts_plot(survival, :mean_growth, :age_in_balance,"{:.0f}", 0:5:40)
fig9 = ts_plot(byceo, :mean_age)
fig10 = histogram(byagepyr13, :age2013, :n_ceos)
fig102 = histogram(byagepyr21, :age2021, :n_ceos)
fig102 = histogram(byagepyr22, :age2022, :n_ceos)
fig11 = ts_plot(byceo, :older60, :year, :"{:.1f}")
fig12 = ts_plot_cat(bycat, :n_firms_cat)
end

main()