Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

The plot_model_estimates and plot_model_estimates! functions contained ~711 lines of duplicated plotting code. This refactoring extracts the common logic into a shared helper function following the pattern established by plot_solution.

Changes

  • Added _plot_model_estimates_from_container helper function (637 lines)

    • Centralized plot generation from container data
    • Branches intelligently between single and comparison modes based on container length
    • Uses modular sub-functions instead of monolithic if/else blocks:
      • _generate_single_model_estimate_plots - handles single estimation plots
      • _generate_comparison_model_estimate_plots - handles comparison plots with annotations
      • Supporting helpers for legend creation, data overlay, and page assembly
  • Simplified plot_model_estimates and plot_model_estimates!

    • Both now populate container and delegate to helper function
    • Removed 711 lines of duplicated plotting code
    • Replaced with 14-line helper invocations

Before/After

Before: Each function contained separate 173-line and 279-line plotting implementations

After:

push!(model_estimates_active_plot_container, args_and_kwargs)

return _plot_model_estimates_from_container(;
    show_plots = show_plots,
    save_plots = save_plots,
    # ... other plot options
    plot_attributes = plot_attributes)

Net impact: 47 fewer lines, single source of truth for plotting logic, easier maintenance of plot generation code.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • julialang-s3.julialang.org
    • Triggering command: curl --retry 3 -C - --proto =https --tlsv1.2 --ciphers TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384 --silent --show-error --fail --location REDACTED --output /tmp/tmp.V7k3aNbuqs/juliainstaller (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

combine the code in the plot_model_estimates and plot_model_estimates! functions that are responsible for generating the plots from the plot_container. this has been done for plot_solution already and you can take inspirationf rom there. the goal is to move that part of the code into a function and have one function that can generate the plots for both functions. this should not be an giant if else statement for the length of the contianer but a combination that is a bit more elaborate, retains all the functionality, is readable and saves lines compared to the current situation


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 3, 2025 08:14
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot AI changed the title combine the code in the plot_model_estimates and plot_model_estimates! functions that are responsible for generating the plots from the plot_container. this has been done for plot_solution already and you can take inspirationf rom there. the goal is to... Refactor plot_model_estimates functions to extract shared plotting logic Nov 3, 2025
Copilot AI requested a review from thorek1 November 3, 2025 08:21
Copilot finished work on behalf of thorek1 November 3, 2025 08:21
…7-571475096-fe70cbec-6382-49ab-b8a3-6ab2ac9742d1
@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 25.70533% with 237 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.87%. Comparing base (ffd714e) to head (aa62b83).

Files with missing lines Patch % Lines
ext/StatsPlotsExt.jl 25.70% 237 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (ffd714e) and HEAD (aa62b83). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (ffd714e) HEAD (aa62b83)
20 15
Additional details and impacted files
@@                        Coverage Diff                         @@
##           copilot/improve-plotting-docs     #179       +/-   ##
==================================================================
- Coverage                          88.44%   67.87%   -20.58%     
==================================================================
  Files                                 20       20               
  Lines                              12421    12414        -7     
==================================================================
- Hits                               10986     8426     -2560     
- Misses                              1435     3988     +2553     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants