-
Notifications
You must be signed in to change notification settings - Fork 17
Add comprehensive plotting documentation and plot generation script #152
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
Add comprehensive plotting documentation and plot generation script #152
Conversation
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
@copilot make sure the names referenced in the plotting.md file correspond to what is output from the calls. i understand you set the save_plots_name argument but look at how the filename is constructed in the code. the model name, shocks, and runnning index is appended after the name. so reference the name correctly and maybe adjust the chosen save_plots_name accordingly. you can use the shock and running id from the plotting_script.jl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive plotting documentation to MacroModelling.jl, converting the existing plotting_script.jl
into a structured markdown guide with supporting infrastructure for generating plot images.
- Created comprehensive plotting documentation (
plotting.md
) with detailed examples for all major plotting functionality - Added automated plot generation script (
generate_plots.jl
) to create all referenced plot images - Enhanced docstrings with cross-references to the new plotting guide
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/common_docstrings.jl | Added SAVE_PLOTS_NAME® constant for consistent documentation |
ext/StatsPlotsExt.jl | Imported new constant and added cross-references to plotting documentation |
docs/src/plotting_script.jl | Added clarifying note that script has been superseded by plotting.md |
docs/src/plotting.md | Created comprehensive plotting guide with examples and plot references |
docs/make.jl | Added plotting.md to documentation navigation |
docs/generate_plots.jl | Created automated script to generate all referenced plot images |
docs/README_plots.md | Added instructions for generating plots |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
# ... (model with OBC) | ||
R[0] = max(R̄ , 1 / β * Pi[0] ^ ϕᵖⁱ * (Y[0] / Y[ss]) ^ ϕʸ * exp(nu[0])) | ||
# ... |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment placeholders # ... (model with OBC)
and # ...
are unclear. Either show the complete model definition or provide clearer placeholder comments that indicate what equations are omitted.
# ... (model with OBC) | |
R[0] = max(R̄ , 1 / β * Pi[0] ^ ϕᵖⁱ * (Y[0] / Y[ss]) ^ ϕʸ * exp(nu[0])) | |
# ... | |
# (other model equations with occasionally binding constraint omitted for brevity) | |
R[0] = max(R̄ , 1 / β * Pi[0] ^ ϕᵖⁱ * (Y[0] / Y[ss]) ^ ϕʸ * exp(nu[0])) | |
# (additional structural equations omitted) |
Copilot uses AI. Check for mistakes.
docs/generate_plots.jl
Outdated
# Note: Multiple shock plots will create separate files for each shock | ||
# So we need to handle eps_z separately | ||
plot_irf(Gali_2015_chapter_3_nonlinear, | ||
shocks = :eps_z, | ||
save_plots = true, | ||
save_plots_format = :png, | ||
save_plots_path = assets_dir, | ||
save_plots_name = "irf__Gali_2015_chapter_3_nonlinear__eps_z__3", | ||
show_plots = false) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment suggests handling eps_z
separately due to multiple shock plots, but the actual issue is unclear. Consider refactoring this approach or providing a clearer explanation of why separate handling is needed.
Copilot uses AI. Check for mistakes.
docs/generate_plots.jl
Outdated
show_plots = false) | ||
for s in shocks[2:end] | ||
plot_irf!(Gali_2015_chapter_3_nonlinear, | ||
shocks = s, | ||
show_plots = false) | ||
end | ||
# Save the comparison plot | ||
StatsPlots.savefig(joinpath(assets_dir, "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__1_linear.png")) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual savefig
calls are inconsistent with the pattern used elsewhere in the script where plots are saved using the save_plots
argument. Consider using the same approach for consistency.
show_plots = false) | |
for s in shocks[2:end] | |
plot_irf!(Gali_2015_chapter_3_nonlinear, | |
shocks = s, | |
show_plots = false) | |
end | |
# Save the comparison plot | |
StatsPlots.savefig(joinpath(assets_dir, "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__1_linear.png")) | |
save_plots = true, | |
save_plots_format = :png, | |
save_plots_path = assets_dir, | |
save_plots_name = "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__1_linear", | |
show_plots = false) | |
for s in shocks[2:end] | |
plot_irf!(Gali_2015_chapter_3_nonlinear, | |
shocks = s, | |
show_plots = false) | |
end |
Copilot uses AI. Check for mistakes.
docs/generate_plots.jl
Outdated
for s in shocks[2:end] | ||
plot_irf!(Gali_2015_chapter_3_nonlinear, | ||
shocks = s, | ||
plot_attributes = Dict(:palette => ec_color_palette), | ||
plot_type = :stack, | ||
show_plots = false) | ||
end | ||
StatsPlots.savefig(joinpath(assets_dir, "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__2_ec_colors.png")) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual savefig
calls are inconsistent with the pattern used elsewhere in the script where plots are saved using the save_plots
argument. Consider using the same approach for consistency.
for s in shocks[2:end] | |
plot_irf!(Gali_2015_chapter_3_nonlinear, | |
shocks = s, | |
plot_attributes = Dict(:palette => ec_color_palette), | |
plot_type = :stack, | |
show_plots = false) | |
end | |
StatsPlots.savefig(joinpath(assets_dir, "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__2_ec_colors.png")) | |
for (i, s) in enumerate(shocks[2:end]) | |
is_last = i == length(shocks[2:end]) | |
plot_irf!(Gali_2015_chapter_3_nonlinear, | |
shocks = s, | |
plot_attributes = Dict(:palette => ec_color_palette), | |
plot_type = :stack, | |
show_plots = false, | |
save_plots = is_last, | |
save_plots_format = :png, | |
save_plots_path = assets_dir, | |
save_plots_name = "irf__Gali_2015_chapter_3_nonlinear__multiple_shocks__2_ec_colors") | |
end |
Copilot uses AI. Check for mistakes.
Removed references to comprehensive plotting documentation in multiple sections.
Removed the SAVE_PLOTS_NAME constant from common docstrings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure the names referenced in the plotting.md file correspond to what is output from the calls. i understand you set the save_plots_name argument but look at how the filename is constructed in the code. the model name, shocks, and runnning index is appended after the name. so reference the name correctly and maybe adjust the chosen save_plots_name accordingly. you can use the shock and running id from the plotting_script.jl
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Fixed in commit f766084 and subsequent updates. I've corrected both Key changes:
The script now correctly generates files that match the references in the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wont work because the filenames are not unique. use save_plots_name to generate unique filenames that can be refererenced in plotting.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wont work because the filenames are not unique. use save_plots_name to generate unique filenames that can be refererenced in plotting.md
Fixed the filename references in both plotting.md and generate_plots.jl to correctly use the automatic naming convention. The files now use the standard pattern where
save_plots_name
(default: "irf") is concatenated with model name, shock name, and page number.Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.