Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAn error with grid.echo() when part of the plot is empty #9
Comments
|
Thanks for the report and excellent diagnosis. I have pushed a fix (that works for your example at least). Note that if you want to combine a couple of these plots together, you might want to use something like ...
... rather than your grid.echo() then grid.grab() approach, so that the plot that you are echoing is drawn within the correct sized region (otherwise what you grab will probably not fit what you draw into). Hope that helps! |
|
Thanks a lot for the fix and it works for me now. Also for the guidance because I'm very new to grid system. Thanks! |
Background: I used a wrapper plot function from the package MatchIt (a package for propensity scoring matching), and find difficulties in putting the graphs together on one page.
My solution: To convert the plots to grid objects first (using
grid.echoandgrid.grab), and then usegrid.arrangeto arrange them.The problem: when using
grid.echo, an error occurs: "Error in unit(x, default.units) : 'x' and 'units' must have length > 0". But the base plot is completely normal, the error only occurs when I try to save the plot as a grid plot.I figured out that this comes from the fact that part of the graph has all FALSE values. Is there any workaround I could do on this?
Here is a minimal reproducible example: