{"id":18053209,"url":"https://github.com/zzawadz/customlayout","last_synced_at":"2025-04-10T19:42:34.198Z","repository":{"id":16329896,"uuid":"19079487","full_name":"zzawadz/customLayout","owner":"zzawadz","description":"Simple extension of basic layout function from R.","archived":false,"fork":false,"pushed_at":"2021-06-08T17:48:14.000Z","size":2890,"stargazers_count":58,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T19:28:28.515Z","etag":null,"topics":["complicated-layouts","graphics","grid-layout","plot","r"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzawadz.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-23T17:46:08.000Z","updated_at":"2024-02-06T14:06:01.000Z","dependencies_parsed_at":"2022-07-26T08:02:18.948Z","dependency_job_id":null,"html_url":"https://github.com/zzawadz/customLayout","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzawadz%2FcustomLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzawadz%2FcustomLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzawadz%2FcustomLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzawadz%2FcustomLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzawadz","download_url":"https://codeload.github.com/zzawadz/customLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281419,"owners_count":21077423,"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":["complicated-layouts","graphics","grid-layout","plot","r"],"created_at":"2024-10-30T23:16:26.323Z","updated_at":"2025-04-10T19:42:34.178Z","avatar_url":"https://github.com/zzawadz.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\ncustomLayout\n========================================================\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n[![GitHub stars](https://img.shields.io/github/stars/zzawadz/customLayout.svg?style=social\u0026label=Stars)](https://github.com/zzawadz/customLayout/stargazers)\n[![GitHub watchers](https://img.shields.io/github/watchers/zzawadz/customLayout.svg?style=social\u0026label=Watch)](https://github.com/zzawadz/customLayout)\n\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/customLayout)](https://cran.r-project.org/package=customLayout)\n[![Downloads](https://cranlogs.r-pkg.org/badges/customLayout)](https://CRAN.R-project.org/package=customLayout)\n[![](https://cranlogs.r-pkg.org/badges/grand-total/customLayout)](https://CRAN.R-project.org/package=customLayout)\n[![Travis-CI Build Status](https://travis-ci.org/zzawadz/customLayout.svg?branch=master)](https://travis-ci.org/zzawadz/customLayout)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/zzawadz/customLayout?branch=master\u0026svg=true)](https://ci.appveyor.com/project/zzawadz/customLayout)\n[![Coverage Status](https://img.shields.io/codecov/c/github/zzawadz/customLayout/master.svg)](https://codecov.io/github/zzawadz/customLayout?branch=master)\n[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\n`customLayout` is a simple extension of the basic `layout` function from `R` but it works not only with `base` and `grid` graphics systems, but also with PowerPoint slides using `officer` package.\n\n## Instalation:\n\n`customLayout` is available on CRAN:\n\n```{r, eval=FALSE}\ninstall.packages(\"customLayout\")\n```\n\nThe development version can be installed from GitHub using `devtools`:\n\n```{r, eval=FALSE}\nlibrary(devtools)\ninstall_github(\"zzawadz/customLayout\")\n```\n\n\n## Basic functionality:\n\nYou can create layouts in the using the same syntax as in the base `layout` function:\n\n```{r base, message = FALSE, results = 'hide', fig.width = 4, fig.height = 2, fig.keep = 'all', fig.pos = 'H'}\nlibrary(customLayout)\nlay \u003c- lay_new(\n  matrix(1:4, nc = 2),\n  widths = c(3, 2),\n  heights = c(2, 1))\nlay_show(lay)\n\nlay2 \u003c- lay_new(\n  matrix(1:4, nc = 2),\n  widths = c(3, 5),\n  heights = c(2, 4))\nlay_show(lay2)\n```\n\nBut the main strength of this package is in combining created layouts with specific ratio:\n\n```{r combine, message = FALSE, results = 'hide', fig.width = 4, fig.height = 2, tidy = FALSE}\n# lay will be 3 times wider that lay2\n# all ascects in lay and lay2 will be preserved\ncl = lay_bind_col(lay, lay2, widths = c(3, 1))\nlay_show(cl)\n```\n\nYou can create even more complicated layouts:\n\n```{r complicated, message = FALSE, results = 'hide', fig.width = 4, fig.height = 2}\nlay3 \u003c- lay_new(matrix(1:2))\nlay4 \u003c- lay_bind_row(cl, lay3, heights = c(5, 2))\nlay_show(lay4)\n\nlay5 \u003c- lay_bind_col(lay4, lay3, widths = c(5, 2))\nlay_show(lay5)\n```\n\n\n## Split layout\n\nYou can create very complicated layouts by splitting one field:\n\n```{r split, message = FALSE, results = 'hide', fig.width = 4, fig.height = 2, tidy = FALSE, fig.keep='all'}\nlibrary(customLayout)\nlay \u003c- lay_new(\n  matrix(1:4, nc = 2),\n  widths = c(3, 2),\n  heights = c(2, 1))\nlay_show(lay)\nlay2 \u003c- lay_new(\n  matrix(1:4, nc = 2),\n  widths = c(3, 5),\n  heights = c(2, 4))\nlay_show(lay2)\n\n# Split field 4 from lay into lay2:\nslay \u003c- lay_split_field(lay, lay2, field = 4)\nlay_show(slay)\n```\n\n\n## Example session:\n\n### Base graphics\n\n```{r example,message = FALSE, results = 'hide', fig.width = 10, fig.height = 6}\nlibrary(customLayout)\npar(mar = c(3, 2, 2, 1))\nlay  \u003c- lay_new(\n  matrix(1:4, nc = 2),\n  widths = c(3, 2),\n  heights = c(2, 1))\nlay2 \u003c- lay_new(matrix(1:3))\ncl   \u003c- lay_bind_col(lay, lay2, widths = c(3, 1))\n\nlay_set(cl) # initialize drawing area\n\nset.seed(123)\nplot(1:100 + rnorm(100))\nplot(rnorm(100), type = \"l\")\nhist(rnorm(500))\nacf(rnorm(100))\npie(c(3, 4, 6), col = 2:4)\npie(c(3, 2, 7), col = 2:4 + 3)\npie(c(5, 4, 2), col = 2:4 + 6)\n```\n\n## Grid graphics (ggplot2 and friends)\n\n```{r examplegrid,message = FALSE, fig.width = 10, fig.height = 6}\nlibrary(customLayout)\nlibrary(ggplot2)\nlibrary(gridExtra)\n\nlay  \u003c- lay_new(\n  matrix(1:2, ncol = 1))\nlay2 \u003c- lay_new(matrix(1:3))\ncl   \u003c- lay_bind_col(lay, lay2, widths = c(3, 1))\n\n\nlibrary(ggplot2)\ncuts \u003c- sort(unique(diamonds[[\"cut\"]]),\n            decreasing = TRUE)\n\nmake_cut_plot \u003c- function(cut) {\n  dd \u003c- diamonds[diamonds[[\"cut\"]] == cut, ]\n  pl \u003c- ggplot(dd) +\n      geom_point(aes(carat, price)) +\n      facet_wrap(\"cut\")\n  pl\n}\n\nplots \u003c- lapply(cuts, make_cut_plot)\n\nlay_grid(plots, cl)\n```\n\n\n## PowerPoint support\n\nLayouts created using `customLayout` package can be used to arrange elements on the PowerPoint slide. For the detailed description please refer to [the vignette](https://www.customlayout.zstat.pl/articles/layouts-for-officer-power-point-document.html):\n\n```{r, eval=FALSE}\nvignette(\"layouts-for-officer-power-point-document\", package = \"customLayout\")\n```\n\n![](man/figures/officer-text.png)\u003c!-- --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzawadz%2Fcustomlayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzawadz%2Fcustomlayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzawadz%2Fcustomlayout/lists"}