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

Pandoc.brew creates unnecessary png-s #57

Closed
cocinerox opened this issue Oct 17, 2013 · 12 comments
Closed

Pandoc.brew creates unnecessary png-s #57

cocinerox opened this issue Oct 17, 2013 · 12 comments

Comments

@cocinerox
Copy link

Pandoc.brew(text="<%=0%>",output="x.md")

creates

/plots/x.md-1.png (what is a white square).

Cheers, L (Ps: Meet you in a week!:)

@daroczig
Copy link
Member

Wow, that's strange indeed. I cannot reproduce this bug, but IMHO this was introduced by some changes in recordPlot in R 3.0.2. Could you please verify your sessionInfo()?

@cocinerox
Copy link
Author

Sure:

R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Hungarian_Hungary.1250 
[2] LC_CTYPE=Hungarian_Hungary.1250   
[3] LC_MONETARY=Hungarian_Hungary.1250
[4] LC_NUMERIC=C                      
[5] LC_TIME=Hungarian_Hungary.1250    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] pander_0.3.9

loaded via a namespace (and not attached):
[1] digest_0.6.3 tools_3.0.2 

@daroczig
Copy link
Member

Cool, thanks! Compiling R 3.0.2 in the near future...

@cocinerox
Copy link
Author

Managed to reproduce it with R 15.2 & pander 0.3.2:

R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Hungarian_Hungary.1250 
[2] LC_CTYPE=Hungarian_Hungary.1250   
[3] LC_MONETARY=Hungarian_Hungary.1250
[4] LC_NUMERIC=C                      
[5] LC_TIME=Hungarian_Hungary.1250    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] pander_0.3.2

loaded via a namespace (and not attached):
[1] digest_0.5.2

@daroczig
Copy link
Member

Hm. Did you ever see such issue before? I have not used pander on Windows for production, but getting my hands on a Windows VM to verify.

@cocinerox
Copy link
Author

I suspect that this happened earlier as well, but did not investigate it...

@daroczig
Copy link
Member

Yeah, indeed. And it also happened when you did not specify the output parameter, but the strange 1px images ended up in the tempdir() on Windows, so that you would not realize this issue :)
Will resolve this soon, thanks again.

@cocinerox
Copy link
Author

Thanks for the fix, works ok! (However, I wonder why these imgs are created at all.)

@daroczig
Copy link
Member

Short demo on the reason why those dummy images are created on Windows:

  • Linux demo:
> t <- tempfile()
> png(t)
> recordPlot()
> dev.off()
null device 
          1 
> file.exists(t)
[1] FALSE
  • Windows demo:
> t <- tempfile()
> png(t)
> recordPlot()
> dev.off()
null device 
          1 
> file.exists(t)
[1] TRUE

@cocinerox
Copy link
Author

Further investigated in Windows:

> t <- tempfile()
> png(t,type = "windows") # default
> dev.off()
null device 
          1 
> file.exists(t)
[1] TRUE
> 
> t <- tempfile()
> png(t,type = "cairo")
> dev.off()
null device 
          1 
> file.exists(t)
[1] FALSE

Maybe a global option for custom type would be advantageous.

daroczig added a commit that referenced this issue Oct 17, 2013
@daroczig
Copy link
Member

After all, I decided to default to cairo instead of a custom global option, as there is no sense in using the windows type instead of cairo if the latter is available. As a matter of fact, since pander depends on R 2.15, this check is rather needless, as it seems all modern Windows builds do support cairo.

Hopefully this will not screw up something on Mac OS :)
Will verify tomorrow. Thanks again! And would love to hear your feedback if this workaround would not be okay, neat or something.

@cocinerox
Copy link
Author

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants