-
Notifications
You must be signed in to change notification settings - Fork 220
Add Vega export functionality for gramm plots #140
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: master
Are you sure you want to change the base?
Conversation
Introduces export_vega.m to enable exporting gramm plots to interactive Vega visualizations, including support for various chart types, color grouping, tooltips, and interactive legends. Adds a corresponding test file and updates functionSignatures.json to register the new export function.
Replaces the old stat handle detection in export_vega.m with a new implementation that extracts actual computed statistics from gramm objects. Adds robust extraction functions for GLM, smooth, bin, summary, boxplot, density, violin, QQ, and bin2d statistics, and updates chart layer creation to use these extracted statistics for accurate Vega layer generation. This enables more reliable and flexible export of statistical layers, including regression lines, confidence intervals, histograms, and more.
|
Hi, thanks for the pull request, the use of Vega seems like a great idea. I will be able to test things out and hopefully merge next week. In the meantime, have you looked at the gh-pages branch to see whether it would be easy to add a webpage demoing vega output to the new gramm page https://piermorel.github.io/gramm/ ? |
|
Hi, I'm Shivam, part of the MathWorks team focused on software development workflows. It’s great to connect with you. I tried out your changes and really appreciate the extensive example you provided to demonstrate the feature. As a general best practice, we usually recommend writing tests for new feature implementations. Since you’ve already put together a thorough example, you might consider leveraging it as a test using the ExamplesDrivenTester toolbox. This approach can help ensure your examples are automatically tested and make it easier to catch any issues. To get the most out of the toolbox, it’s helpful to separate each example into its own MATLAB file. This way, if something fails, it’s easier to pinpoint the exact example. You can also generate a code coverage report to verify that all functionalities are being tested. Here’s a quick illustration of how you might do this: Following is a screenshot of the code coverage report for the “export_vega_test.m”:
Please refer the following page for more details on the Examples Driven Tester Toolbox: |
|
Additionally, I noticed that the changes for method declaration of “export_vega.m” in “gramm.m” has not been committed in the Pull Request. Could you please double-check if those changes are included? |
|
Hi @Delen0828 , as @slahoti1 mentioned the export_vega declaration in gramm.m is not there. I added it manually and am able to generate the html and json files on my computer. However when I open the html in my browser I just get a blank page (tried on Safari and Firefox), is that normal behaviour ? |
|
Hello Pierre and Shivam, sorry for the late update -- I was busy with other project in the previous months. @slahoti1 Thanks for recommending the toolbox and I found it useful. I tested it on the combined test file for now, and I will split it to individual files as you recommended for future development. I also added the declaration in gramm.m @piermorel Thanks for testing, Pierre. The html files requires a local server (e.g. |

Introduces
export_vega.mto enable exporting gramm plots to interactive Vega visualizations, including support for various chart types (geom_*methods), color grouping, tooltips, and interactive legends.Adds a corresponding test file
export_vega_test.mand updatesfunctionSignatures.jsonto register the new export function.