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

Graphs not rendering in PDF when using dev.new() with knitr #2355

Open
Higgs32584 opened this issue Jul 9, 2024 · 3 comments
Open

Graphs not rendering in PDF when using dev.new() with knitr #2355

Higgs32584 opened this issue Jul 9, 2024 · 3 comments
Assignees

Comments

@Higgs32584
Copy link

Screenshot 2024-07-09 120145
Screenshot 2024-07-09 120128
Screenshot 2024-07-09 120101

Hi, so recently, I was using knitr to compile graphs for my homework and, I was adding dev.new() before all of my graphs, as I thought this was the normal format to create graphs in.
What did end up happening though, is that graphs that followed dev.new() did not render at all in the pdf. while I understand dev.new is a function in the graphics package, I ran into no issues when compiling the graphs in markdown, as they all displayed perfectly fine, the code interaction seems to be related specifically towards how knitr compiles .rmd into a .pdf.

A warning label related to instances of dev.new() in the compilation would be ideal, as I imagine taking into account new graph windows might be too complex.

library("robustbase")
data("coleman",package="robustbase")
dev.new()
barplot(salaryP ~ fatherWc,data=coleman)
dev.new()
plot(salaryP ~ fatherWc,data=coleman)
@Higgs32584 Higgs32584 changed the title Graphs do not render when they follow dev.new Graphs not rendering in PDF when using dev.new() with knitr Jul 9, 2024
@cderv
Copy link
Collaborator

cderv commented Jul 11, 2024

Hi.

Can you share you session information please ?

I wonder if this is linked to an update in the evaluate package for 0.24

@cderv
Copy link
Collaborator

cderv commented Jul 11, 2024

@yihui I am not sure if we made changes recently that would have caused this... I tried different version with no success.

You know better than me how dev.new() works in chunks. My understanding is that it is not needed, but shouldn't behave like it is here.

@Higgs32584
Copy link
Author

Higgs32584 commented Jul 11, 2024

Screenshot 2024-07-11 103307
If you have any more questions let me know.

Since this deals with the interactions of multiple packages, it may not necessarily be this package, but my educated guess was this package, given the fact the graph renders fine until the pdf generation.

If there is another package you may believe it is, I will open an issue there as well.

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

3 participants