-
Notifications
You must be signed in to change notification settings - Fork 3
Added interactive plot and high-resolution plot download feature #4
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
base: main
Are you sure you want to change the base?
Conversation
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 interactive plotly visualization support and high-resolution plot downloads to the ggbot2 application. The AI can now automatically choose between static ggplot2 and interactive plotly visualizations based on user requests or data characteristics.
- Added
run_r_plotly_code
function and tool for generating interactive plotly plots - Implemented PNG download functionality with 300 DPI resolution for both static and interactive plots
- Fixed initial microphone button state to properly reflect muted status
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
inst/prompts/prompt.md | Updated AI instructions to support both static and interactive plot generation |
R/ggbot2.R | Added plotly support, download functionality, and UI improvements |
NAMESPACE | Added grDevices imports for PNG generation |
DESCRIPTION | Added plotly and image export dependencies |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
R/ggbot2.R
Outdated
kaleido_worked <- FALSE | ||
if (requireNamespace("kaleido", quietly = TRUE)) { | ||
tryCatch({ | ||
kaleido::save_image(plotly_obj, file, width = 3000, height = 2400) |
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 kaleido::save_image function parameters may not match this signature. The kaleido package typically uses different parameter names or structure. Verify the correct API usage for kaleido image export.
kaleido::save_image(plotly_obj, file, width = 3000, height = 2400) | |
kaleido::save_image(plotly_obj, file, options = list(width = 3000, height = 2400)) |
Copilot uses AI. Check for mistakes.
R/ggbot2.R
Outdated
if (!kaleido_worked) { | ||
tryCatch({ | ||
# plotly::save_image uses kaleido under the hood | ||
plotly::save_image(plotly_obj, file, width = 3000, height = 2400) |
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 plotly::save_image function may require different parameters than specified. Verify that width and height parameters are supported in this format, as plotly typically expects different argument structures for image dimensions.
plotly::save_image(plotly_obj, file, width = 3000, height = 2400) | |
plotly::save_image(plotly_obj, file, export = list(width = 3000, height = 2400)) |
Copilot uses AI. Check for mistakes.
R/ggbot2.R
Outdated
webshot2::webshot(temp_html, file, vwidth = 3000, vheight = 2400) | ||
} else { | ||
webshot::webshot(temp_html, file, vwidth = 3000, vheight = 2400) |
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.
Using 3000x2400 pixel dimensions for webshot may cause performance issues or memory problems, especially for complex plotly visualizations. Consider using more reasonable dimensions and scaling appropriately.
webshot2::webshot(temp_html, file, vwidth = 3000, vheight = 2400) | |
} else { | |
webshot::webshot(temp_html, file, vwidth = 3000, vheight = 2400) | |
webshot2::webshot(temp_html, file, vwidth = 1200, vheight = 900) | |
} else { | |
webshot::webshot(temp_html, file, vwidth = 1200, vheight = 900) |
Copilot uses AI. Check for mistakes.
Interactive Plot Support
Download Button
Other improvements