Skip to content
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

print issue with layout + functions #404

Open
lindsayplatt opened this issue Aug 22, 2016 · 2 comments
Open

print issue with layout + functions #404

lindsayplatt opened this issue Aug 22, 2016 · 2 comments

Comments

@lindsayplatt
Copy link

Despite the fact that none of my examples showed this during our 10 min meeting - this is an issue! layout doesn't work when the plot object is returned from a function because of the on.exit(dev.flush()) line in print.R (works when you comment that out). When the creation of a new gsplot object is outside of the function, it is fine. But when it's inside the function, the layout is ignored.

Works:

makeSimplePlot2 <- function(g1){
    g1 <- g1 %>%
        lines(1:9, seq(1,3, by=0.25),
              legend.name="second line") %>% 
        axis(side=2, at=1:10)
    return(g1)
}

g1 <- gsplot()
layout(matrix(1:2, 1, 2))
makeSimplePlot2(g1)
makeSimplePlot2(g1)

image

Doesn't work:

makeSimplePlot1 <- function(){
    g1 <- gsplot() %>%
        lines(1:9, seq(1,3, by=0.25),
              legend.name="second line") %>% 
        axis(side=2, at=1:10)
    return(g1)
}

layout(matrix(1:2, 1, 2))
makeSimplePlot1()
makeSimplePlot1()

image

@lindsayplatt
Copy link
Author

@ldecicco-USGS @jiwalker-usgs @wdwatkins here's the example that I was trying to show - sorry I didn't copy the correct one into the meeting event.

@lindsayplatt
Copy link
Author

jiwalker - might be messing with other stuff. We don't know

@lindsayplatt lindsayplatt removed this from the v0.7.X milestone Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant