The main change is that the previous typst code failed for continuous legends (the output just contained the legend, not the plot), see the example below where the legend is displayed but the plot itself is missing
For this there is some issue with the way Observable Plot generates legend svg's. Basically some tick labels can extend beyond the viewbox which is ok in HTML, but gets trimmed in typst. To facilitate this I added a further option legend-padding which by default is set to 20pt. Here is an example of the problem and how it looks with default padding. One could also have left and right padding separately but not sure it is worth the complexity.
I made a small change to enable format-options and path="test.pdf" in Plot.plot, I think both would be useful to have there?
I made a small change so that the margin option can be given with units (eg 12pt, 1in, etc) but maybe this is too complicated?
This is a follow to the previous pull request.
The main change is that the previous typst code failed for continuous legends (the output just contained the legend, not the plot), see the example below where the legend is displayed but the plot itself is missing
For this there is some issue with the way Observable Plot generates legend
svg
's. Basically some tick labels can extend beyond theviewbox
which is ok in HTML, but gets trimmed in typst. To facilitate this I added a further optionlegend-padding
which by default is set to20pt
. Here is an example of the problem and how it looks with default padding. One could also have left and right padding separately but not sure it is worth the complexity.I made a small change to enable
format-options
andpath="test.pdf"
inPlot.plot
, I think both would be useful to have there?I made a small change so that the
margin
option can be given with units (eg12pt
,1in
, etc) but maybe this is too complicated?