Skip to content

Commit

Permalink
style: align day numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Mar 31, 2024
1 parent 0d6cb38 commit 81c0198
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/plot_calendar.R
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ plot_calendar <- function(year = format(Sys.Date(), "%Y"),

## Add day number ----

text(x = calendar[i, "x"] - 1.04,
x_at <- ifelse(length(unique(calendar$"en_weekday")) == 7, 0.02, 0.03)

text(x = calendar[i, "x"] - (1 + x_at),
y = calendar[i, "y"] - 0.10,
labels = calendar[i, "day"],
pos = 4,
Expand All @@ -367,9 +369,11 @@ plot_calendar <- function(year = format(Sys.Date(), "%Y"),

if (moon) {

x_at <- ifelse(length(unique(calendar$"en_weekday")) == 7, 0.10, 0.06)

if (calendar[i, "date"] %in% moon_dates$"new_moon") {

points(x = calendar[i, "x"] - 0.10,
points(x = calendar[i, "x"] - x_at,
y = calendar[i, "y"] - 0.10,
pch = 21,
col = "#333333",
Expand All @@ -379,7 +383,7 @@ plot_calendar <- function(year = format(Sys.Date(), "%Y"),

if (calendar[i, "date"] %in% moon_dates$"full_moon") {

points(x = calendar[i, "x"] - 0.10,
points(x = calendar[i, "x"] - x_at,
y = calendar[i, "y"] - 0.10,
pch = 21,
col = "#333333",
Expand Down

0 comments on commit 81c0198

Please sign in to comment.