{"id":13711218,"url":"https://github.com/GabrielSlPires/ggdaynight","last_synced_at":"2025-05-06T20:32:19.981Z","repository":{"id":240425354,"uuid":"802594216","full_name":"GabrielSlPires/ggdaynight","owner":"GabrielSlPires","description":"Add Day/Night Patterns to ggplot2 Plots","archived":false,"fork":false,"pushed_at":"2024-05-22T13:32:23.000Z","size":211,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-22T14:30:52.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GabrielSlPires.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-18T18:24:21.000Z","updated_at":"2024-06-12T15:39:13.496Z","dependencies_parsed_at":"2024-05-22T14:30:26.100Z","dependency_job_id":"90e89b09-7011-4687-b52e-c33b93926370","html_url":"https://github.com/GabrielSlPires/ggdaynight","commit_stats":null,"previous_names":["gabrielslpires/ggdaynight"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielSlPires%2Fggdaynight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielSlPires%2Fggdaynight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielSlPires%2Fggdaynight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielSlPires%2Fggdaynight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GabrielSlPires","download_url":"https://codeload.github.com/GabrielSlPires/ggdaynight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252764588,"owners_count":21800717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:01:05.856Z","updated_at":"2025-05-06T20:32:18.881Z","avatar_url":"https://github.com/GabrielSlPires.png","language":"R","funding_links":[],"categories":["Plot layers"],"sub_categories":[],"readme":"\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/GabrielSlPires/ggdaynight/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/GabrielSlPires/ggdaynight/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/ggdaynight)](https://CRAN.R-project.org/package=ggdaynight)\n[![](https://cranlogs.r-pkg.org/badges/grand-total/ggdaynight)](https://cran.r-project.org/package=ggdaynight)\n\u003c!-- badges: end --\u003e\n\n# ggdaynight \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"\" /\u003e\n\n`ggdaynight` is an R package that adds a day/night pattern to ggplot2 plots. Daytime is represented by rectangles filled with a specified `day_fill` color and nighttime by rectangles filled with a specified `night_fill` color. The pattern is created along the x-axis, which must be a datetime variable.\n\n## Installation\n\nYou can install the released version of `ggdaynight` from CRAN:\n\n```\ninstall.packages(\"ggdaynight\")\n```\n\nYou can install the development version of `ggdaynight` from GitHub with:\n\n```\n# Install devtools if not already installed\nif (!requireNamespace(\"devtools\", quietly = TRUE)) {\n  install.packages(\"devtools\")\n}\n\n# Install ggdaynight from GitHub\ndevtools::install_github(\"GabrielSlPires/ggdaynight\")\n```\n## Usage\nBasic Usage with Default Parameters\n```\nlibrary(ggplot2)\nlibrary(ggdaynight)\n\nggplot(daynight_temperature, aes(datetime, temperature)) +\n  geom_daynight() +\n  geom_point() +\n  theme_classic()\n```\n![basic plot](man/figures/basic-plot.png)\n\nBasic Usage with Faceting by Sensor\n```\nggplot(daynight_temperature, aes(datetime, temperature)) +\n  geom_daynight() +\n  geom_point() +\n  facet_wrap(vars(sensor)) +\n  theme_classic()\n```\n![facet plot](man/figures/facet-plot.png)\n\nUsage with Lines and Color by Sensor\n```\nggplot(daynight_temperature, aes(datetime, temperature, color = sensor)) +\n  geom_daynight() +\n  geom_line(linewidth = 1) +\n  theme_classic()\n```\n![color plot](man/figures/color-plot.png)\n\nCustom Day and Night Fill Colors, Custom Sunrise and Sunset Times, and Adjusted Alpha\n```\nggplot(daynight_temperature, aes(datetime, temperature, group = sensor)) +\n  geom_daynight(day_fill = \"yellow\", night_fill = \"blue\",\n                sunrise = 5, sunset = 20, alpha = 0.5) +\n  geom_line(linewidth = 1) +\n  theme_classic()\n```\n![custom plot](man/figures/custom-plot.png)\n\n### Function Details\n\n#### geom_daynight\n\nAdds a day/night pattern to a ggplot object.\n\n##### Arguments\n\n* `day_fill`: The fill color for daytime rectangles. Defaults to `\"white\"`.\n* `night_fill`: The fill color for nighttime rectangles. Defaults to `\"grey30\"`.\n* `sunrise`: The hour at which daytime starts. Defaults to 6 (6 AM).\n* `sunset`: The hour at which nighttime starts. Defaults to 18 (6 PM).\n* `...`: Additional arguments passed to `geom_rect`.\n\n##### Value\n\nA ggplot2 layer representing the day/night pattern.\n\n### Contributing\n\nPlease feel free to submit issues and pull requests to the repository. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGabrielSlPires%2Fggdaynight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGabrielSlPires%2Fggdaynight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGabrielSlPires%2Fggdaynight/lists"}