Skip to content

Too big figures in the report #73

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

Open
scilexenko opened this issue Feb 20, 2025 · 3 comments
Open

Too big figures in the report #73

scilexenko opened this issue Feb 20, 2025 · 3 comments
Labels
Bug Fixed This bug has been addressed and resolved in the latest update. bug Something isn't working

Comments

@scilexenko
Copy link

Hi,

I’ve been using your very helpful MicrobiomeStat package and wanted to generate a report. However, in the PDF version, the figures appear too large and don’t fit on the page.

I tried adjusting pdf.wid and pdf.hei, but it didn’t seem to help.

Could you advise on how to properly resize the figures?

Thank you for your help!

Best,
Ivan

Image

@scilexenko scilexenko added the bug Something isn't working label Feb 20, 2025
@cafferychen777
Copy link
Owner

Dear Ivan,

Thank you for reaching out and for using MicrobiomeStat! I understand the issue with the figure sizing in the PDF report. Looking at the report generation code, I've noticed that the figure dimensions might be set too large. Let's adjust those parameters to make the figures fit properly on the page.

In the report template, please locate the chunk settings that look like this:

{r taxa-areaplot-longitudinal-print, echo=FALSE, message=FALSE, results=result.output, fig.align='center', fig.width = 25, fig.height = 15, warning = FALSE}

I recommend modifying the fig.width and fig.height parameters to more reasonable values:

Please try these adjusted parameters and let me know if the figures are now displaying at a more appropriate size in your PDF report.

Best regards,
Caffery

@cafferychen777 cafferychen777 added the Bug Fixed This bug has been addressed and resolved in the latest update. label Feb 20, 2025
@scilexenko
Copy link
Author

scilexenko commented Feb 24, 2025

Hello Chen,

Thank you for the quick response. However, I used a native function from your package (mStat_generate_report_long), and it doesn’t seem to have an option to change the chunk settings—correct me if I’m wrong. The fig.width and fig.height options don’t seem to work for adjusting the figure size in the final auto-generated report.

Best regards,
Ivan

@cafferychen777
Copy link
Owner

Dear Ivan,

Thank you for your follow-up and for clarifying that you're using the mStat_generate_report_long function. You're absolutely right - this function currently uses hardcoded figure dimensions in the report template that don't allow for easy customization through parameters.

I've investigated the issue further and can see that the current implementation works well for most standard cases, but becomes problematic when there are many levels or groups, as in your situation. The figures then become too large to fit properly on the page.

For the next release of MicrobiomeStat, I'm planning to implement an adaptive figure sizing system that will:

  1. Automatically adjust figure dimensions based on the number of groups, levels, and features being displayed
  2. Add new parameters to the report generation functions that allow users to customize figure dimensions
  3. Implement better page layout management for PDF output

As a temporary workaround, you could:

  • Generate the individual plots separately using the component functions with custom dimensions
  • Use the report HTML output format which tends to handle large figures better than PDF

I appreciate you bringing this issue to my attention. It's now on our development roadmap and will be addressed in the upcoming release.

Best regards,
Chen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fixed This bug has been addressed and resolved in the latest update. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants