{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/bookdown/issues/181","repository_url":"https://api.github.com/repos/rstudio/bookdown","labels_url":"https://api.github.com/repos/rstudio/bookdown/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/bookdown/issues/181/comments","events_url":"https://api.github.com/repos/rstudio/bookdown/issues/181/events","html_url":"https://github.com/rstudio/bookdown/issues/181","id":172317680,"number":181,"title":"several include_graphics calls behave differently than several qplot calls","user":{"login":"maxheld83","id":5372770,"avatar_url":"https://avatars.githubusercontent.com/u/5372770?v=3","gravatar_id":"","url":"https://api.github.com/users/maxheld83","html_url":"https://github.com/maxheld83","followers_url":"https://api.github.com/users/maxheld83/followers","following_url":"https://api.github.com/users/maxheld83/following{/other_user}","gists_url":"https://api.github.com/users/maxheld83/gists{/gist_id}","starred_url":"https://api.github.com/users/maxheld83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxheld83/subscriptions","organizations_url":"https://api.github.com/users/maxheld83/orgs","repos_url":"https://api.github.com/users/maxheld83/repos","events_url":"https://api.github.com/users/maxheld83/events{/privacy}","received_events_url":"https://api.github.com/users/maxheld83/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-21T11:56:35Z","updated_at":"2016-08-31T03:28:39Z","closed_at":null,"body":"Consider these three examples:\r\n\r\n**Chunk with margin.fig = TRUE and 4 qplots and vector of 4 fig.cap**\r\n\r\n```{r q-pic, echo=FALSE, out.width=\"100%\", fig.cap=c(\"Participant considers all items.\", \"Participant chooses two *similar* items, names category.\", \"Participant applies categories to all items.\", \"All items are categorized as TRUE or FALSE.\"), dpi = 72, fig.margin = TRUE, fig.show = \"asis\"}\r\nqplot(x = 1:10, y = 1:10)\r\nqplot(x = 1:10, y = 1:10)\r\nqplot(x = 1:10, y = 1:10)\r\nqplot(x = 1:10, y = 1:10)\r\n```\r\n\r\nyields **as intended, with different captions**\r\n![screen shot 2016-08-21 at 13 52 11](https://cloud.githubusercontent.com/assets/5372770/17836975/ab942e6e-67a6-11e6-95f9-1adccb017442.png)\r\n\r\n----\r\n\r\n**Chunk with margin.fig = TRUE and 4 include_graphics and vector of 4 fig.cap**\r\n\r\n```{r q-pic, echo=FALSE, out.width=\"100%\", fig.cap=c(\"Participant considers all items.\", \"Participant chooses two *similar* items, names category.\", \"Participant applies categories to all items.\", \"All items are categorized as TRUE or FALSE.\"), dpi = 72, fig.margin = TRUE, fig.show = \"asis\"}\r\ninclude_graphics(path = \"img/q-cat-stage-0.png\")\r\ninclude_graphics(path = \"img/q-cat-stage-1.png\")\r\ninclude_graphics(path = \"img/q-cat-stage-2.png\")\r\ninclude_graphics(path = \"img/q-cat-stage-3.png\")\r\n```\r\n\r\nyields **incorrectly with all the same captions**\r\n![screen shot 2016-08-21 at 13 52 55](https://cloud.githubusercontent.com/assets/5372770/17836980/cd2f26aa-67a6-11e6-89d0-79bf5f6e7e4d.png)\r\n\r\n----\r\n\r\n**Chunk with margin.fig = TRUE and include_graphics() with 4-long vector and vector of 4 fig.cap**\r\n\r\nlastly, when passing a vector to `include_graphics()`, it **works fine again**\r\n\r\n```{r q-pic, echo=FALSE, out.width=\"100%\", fig.cap=c(\"Participant considers all items.\", \"Participant chooses two *similar* items, names category.\", \"Participant applies categories to all items.\", \"All items are categorized as TRUE or FALSE.\"), dpi = 72, fig.margin = TRUE, fig.show = \"asis\"}\r\ninclude_graphics(path = c(\"img/q-cat-stage-0.png\", \"img/q-cat-stage-1.png\", \"img/q-cat-stage-2.png\", \"img/q-cat-stage-3.png\"))\r\n```\r\n\r\n![screen shot 2016-08-21 at 13 55 36](https://cloud.githubusercontent.com/assets/5372770/17837003/4d52203a-67a7-11e6-86a7-22bb56f41da6.png)\r\n\r\n\r\n----\r\n\r\nI expected that `include_graphics()` would behave basically like any other graphics-producing call, but that appears not to be the case; to set *separate* `fig.cap` for each plot, the `include_graphics()` must called *only* once, with a vector of files.\r\n`qplot()` can be called several times, and uses the different `fig.cap` as intended.\r\n\r\nIs this intended behavior, or did I miss something?\r\n"},"comment":{"url":"https://api.github.com/repos/rstudio/bookdown/issues/comments/243648435","html_url":"https://github.com/rstudio/bookdown/issues/181#issuecomment-243648435","issue_url":"https://api.github.com/repos/rstudio/bookdown/issues/181","id":243648435,"user":{"login":"yihui","id":163582,"avatar_url":"https://avatars.githubusercontent.com/u/163582?v=3","gravatar_id":"","url":"https://api.github.com/users/yihui","html_url":"https://github.com/yihui","followers_url":"https://api.github.com/users/yihui/followers","following_url":"https://api.github.com/users/yihui/following{/other_user}","gists_url":"https://api.github.com/users/yihui/gists{/gist_id}","starred_url":"https://api.github.com/users/yihui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihui/subscriptions","organizations_url":"https://api.github.com/users/yihui/orgs","repos_url":"https://api.github.com/users/yihui/repos","events_url":"https://api.github.com/users/yihui/events{/privacy}","received_events_url":"https://api.github.com/users/yihui/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T03:28:39Z","updated_at":"2016-08-31T03:28:39Z","body":"Looks like a bug of `include_graphics()`... At the moment I have no idea about how to fix it, though."}}
{"actor":{"display_login":"yihui"}}