{"id":32199494,"url":"https://github.com/ben-williams/tickr","last_synced_at":"2026-03-12T09:20:11.684Z","repository":{"id":286690881,"uuid":"962230223","full_name":"ben-williams/tickr","owner":"ben-williams","description":"Making consistent tick marks for R plots","archived":false,"fork":false,"pushed_at":"2025-04-10T16:01:09.000Z","size":58,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T15:58:05.857Z","etag":null,"topics":["axis-labels","ggplot2","ticks"],"latest_commit_sha":null,"homepage":"","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/ben-williams.png","metadata":{"files":{"readme":"README.Rmd","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-07T21:04:08.000Z","updated_at":"2025-04-14T02:26:52.000Z","dependencies_parsed_at":"2025-04-07T22:25:09.530Z","dependency_job_id":"6e95798d-d6fa-49c4-9a98-95c9f42954ff","html_url":"https://github.com/ben-williams/tickr","commit_stats":null,"previous_names":["ben-williams/tickr"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ben-williams/tickr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-williams%2Ftickr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-williams%2Ftickr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-williams%2Ftickr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-williams%2Ftickr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben-williams","download_url":"https://codeload.github.com/ben-williams/tickr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-williams%2Ftickr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280372014,"owners_count":26319533,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["axis-labels","ggplot2","ticks"],"created_at":"2025-10-22T03:17:21.804Z","updated_at":"2025-10-22T03:17:22.775Z","avatar_url":"https://github.com/ben-williams.png","language":"R","funding_links":[],"categories":["Presentation, composition and scales"],"sub_categories":[],"readme":"---\r\noutput: github_document\r\n---\r\n\r\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\r\n\r\n```{r, include = FALSE}\r\nknitr::opts_chunk$set(\r\n  collapse = TRUE,\r\n  comment = \"#\u003e\",\r\n  fig.path = \"man/figures/README-\",\r\n  out.width = \"100%\"\r\n)\r\n```\r\n\r\n# tickr\r\n\r\n\u003c!-- badges: start --\u003e\r\n![CRAN/METACRAN Version](https://img.shields.io/cran/v/tickr)\r\n\u003c!-- badges: end --\u003e\r\n\r\nThis is a small package to provide consistent tick marks for plotting `ggplot2` figures. \r\nIt provides breaks and labels for ggplot2 without requiring ggplot2 to be installed.\r\n\r\n## Installation\r\n\r\nYou can install the development version of `tickr` from GitHub:\r\n\r\n``` r\r\n# install.packages(\"remotes\")\r\nremotes::install_github(\"BenWilliams-NOAA/tickr\")\r\n```\r\n\r\n## Example\r\n\r\n```{r setup}\r\nlibrary(tickr)\r\nlibrary(ggplot2)\r\nlibrary(dplyr)\r\n```\r\n\r\nSome basic examples of how to use the `tickr` package.\r\n\r\n```{r}\r\n# Create a data.frame\r\ndf \u003c- data.frame(year = 2000:2020,\r\n                 spawning_biomass = rnorm(21,100, 0.25))\r\n\r\n# explore tickr output\r\ntickr(df, var=year)\r\ntickr(df, var=year, by=2)\r\ntickr(df, var=year, by=5, var_min = 1998, var_max = 2024, lab_start = 1998, lab_end = 2017)\r\ntickr(df, var=year, by=5, var_min = 1998, var_max = 2024, lab_start = 1998, lab_end = 2017)\r\n\r\n# explore plotting options\r\n# default ggplot\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point()\r\n\r\n# a tick mark for every year\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point() +\r\n  scale_x_tickr(data=df, var=year)\r\n\r\n# a tick mark for every year \u0026 label every 2nd year\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point() +\r\n  scale_x_tickr(data=df, var=year, by = 2)\r\n\r\n# determine the years that are labeled\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point() +\r\n  scale_x_tickr(data=df, var=year, by = 5, \r\n                var_min = 1997, \r\n                var_max = 2024, \r\n                lab_start = 1997) \r\n\r\n# determine the years that are labeled\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point() +\r\n  scale_x_tickr(data=df, var=year, by = 2, \r\n                var_min = 2010, \r\n                lab_start = 2010)\r\n\r\n# show future years\r\nggplot(df, aes(year, spawning_biomass)) + \r\n  geom_line() +\r\n  geom_point() +\r\n  scale_x_tickr(data=df, var=year, by = 5, \r\n                var_min = 2015, \r\n                var_max = 2026, \r\n                lab_start = 2015, \r\n                lab_end = 2026) +\r\n  expand_limits(x = c(1998, 2026)) \r\n\r\n```\r\n\r\nThe same general approach is available for y axes as well.\r\n\r\n```{r}\r\ndf \u003c- expand.grid(age = 1:10,\r\n                 year = 2000:2009) %\u003e% \r\n  dplyr::mutate(value = rnorm(100, 1, 1))\r\n\r\ndf %\u003e% \r\n  ggplot(aes(year, age, size=value)) + \r\n  geom_point() +\r\n  scale_size_area() +\r\n  scale_x_tickr(data=df, var=year, by=2, var_max = 2012, lab_end = 2012) +\r\n  scale_y_tickr(data=df, var=age, by=2) +\r\n  expand_limits(y=0, x=2012)\r\n\r\n\r\n```\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-williams%2Ftickr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben-williams%2Ftickr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-williams%2Ftickr/lists"}