Blocking chart is not displayed correctly for PDF #1990
-
How can I display the cumulative_num_comparisons_from_blocking_rules_chart as PNG for PDF correctly? I am using Quarto. On my test data, this code produces the PNG chart for HTML: The blocking chart is displayed correctly for HTML: To save the PNG for PDF, I used a basic variation of the recommendation on the Splink July 2023 blog on how to save Altair 5 charts:
However, the blocking chart is NOT displayed correctly for PDF. The PNG for PDF has unwanted space to the left of the y-title and, therefore, the rest of the chart is too small: Please advice. Is this a bug in Splink? The issue is only for displaying the blocking chart for PDF (not for HTML, and not for other charts). Update 1: The original PNG chart for HTML was outdated, using slightly different data. This has been corrected. The original discussion is pull 660. I am using Splink 3.9.12 (latest) and Altair 5.2.0 (latest). The Splink documentation on Altair charts provides background context. My work-around solution in Quarto is to reuse the PNG graph rendered for HTML as the PNG graph for PDF. It works but is clumsy to have to run code twice. There should be a way to save the PNG chart without distortions when rendering to PDF. Update 2: The Altair web page for saving charts is saving_charts.html. The code Update 3: I am using Quarto 1.4.550 (latest) on Windows 10. Since the Altair chart is correctly displayed in Vega editor but the saved PNG is not correctly displayed (regardless of Quarto ), I conclude that it is an Altair issue: Altair does not correctly Update 4: I concluded that the issue primarily is with Altair. Altair is not correctly saving the Splink blocking comparison chart as PNG. Therefore, I have now opened Altair discussion issue 3336. Update 5: Altair has now raised vl-convert issue 152 for this. Update 6: The bug has been fixed in vega/vl-convert/pull/153. The bug fix will be available in the next Update 7: The corrected vl-convert 1.2.4 has been released. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hiya. Thanks for raising this - was just about to look into it but pleased to find you now have a solution! Thanks for going the extra mile, getting it reported and fixed.- great work!! |
Beta Was this translation helpful? Give feedback.
Hiya. Thanks for raising this - was just about to look into it but pleased to find you now have a solution! Thanks for going the extra mile, getting it reported and fixed.- great work!!