R-CoderDotCom / calendR

Ready to print calendars with ggplot2
https://r-coder.com/calendar-plot-r/
MIT License
252 stars 35 forks source link

can't export as A4 using Rscript #19

Closed demorsick closed 1 year ago

demorsick commented 1 year ago

after I Rscript file.R content of file.R : pdf(paper = "a4") library(calendR) dates <- seq(as.Date("2023-01-01"), as.Date("2023-01-31"), by = "1 day") events <- ifelse(format(dates, "%w") %in% c(0), "Domenica", NA) events[1] <- "Festività" events[c(5, 22, 8)] <- "Compleanni" calendR(year = 2023, special.days = c(events), special.col = c("lightgreen","blue","#bfe2f2"), legend.pos = "bottom", month = 1, start = "M", title = "Gennaio", title.size = 70, title.col = 2, weeknames = c("L", "M", "M", "G","V", "S", "D"), col = "#f2f2f2", lwd = 1, lty = 1, mbg.col = 4, weeknames.col = "red", days.col = "black", # Color of the number of the days day.size = 5, # Size of the number of days bg.img = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.settemuse.it%2Fsfondi_ambiente%2Fstagione_inverno%2Fstagione_inverno_013.jpg&f=1&nofb=1&ipt=988c0a811e94f34c73f5d49afd3c897a2c17332da6d5bfd6528ce3017814123a&ipo=images") # Background image dev.off() i get this pdf which is badly formatted Rplots.pdf

mschilli87 commented 1 year ago

@demorsick: Have you tried generating a PDF as suggested in the calendR README instead of writing your own code to do so?


Also, I cannot try to work with your code due to all newlines being gone. Do mind editing you post from

`
[1st line of code]
[2nd line]
...
[last line of code]
`

which renders as

[1st line of code] [2nd line] ... [last line of code]

(see above) to

```r
[1st line of code]
[2nd line]
...
[last line of code]

which renders as

[1st line of code] [2nd line] ... [last line of code]



with R syntax highlighting?
1ilir0lika commented 1 year ago

right now i can't,but even when i follow the example it does give me that output,unless i'm using Rstudio i'm on fedora 36

mschilli87 commented 1 year ago

I do not use RStudio and have successfully generated A4 calendars before. So once I can test your code, I'll try to track this down.

demorsick commented 1 year ago

here is the code https://pastebin.com/zq1esQfC ,the output is always https://github.com/R-CoderDotCom/calendR/files/9748320/Rplots.pdf

demorsick commented 1 year ago

I'm sorry if made you waste your time,the problem was that i forgot to type pdf=TRUE,but with Rstudio I didn't had to it