-
DescriptionI like to have notes under my figures and tables describing what is in them. Typically with Latex, I can achieve this with the
How can I achieve the same thing with Quarto? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 58 replies
-
Beta Was this translation helpful? Give feedback.
-
I believe that keeping captions on top for tables and at the bottom for figures is a good practice. |
Beta Was this translation helpful? Give feedback.
-
Note that the major work from #4944 was merged into |
Beta Was this translation helpful? Give feedback.
-
I would like to create graphics with a note below the graphic "Source: @author.year." . I am in the process of writing a comprehensive publication for which Quarto and R would be very suitable. However, unless I can comply with scientific citation rules, I cannot use Quarto despite its great potential. Will it be possible to add notes/references to graphs in the foreseeable future? The most elegant solution would be a parmater like |
Beta Was this translation helpful? Give feedback.
-
Precisely, that's the point I tried to make here: #6103 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
@mcanouil I think his issue is the same as mine and @danielvartan 's : how to have legend on top and source (and other notes fwiw) on bottom? |
Beta Was this translation helpful? Give feedback.
-
Yes, that's the solution I'm using right now. It is not ideal for my use, though, as one of the main reasons I use Quarto instead of e.g. Overleaf is to reproduce graphics on the run (and besides I have more familiarity with Rmd than LaTeX). Maybe is there a way to include R code inside the figure environment? I tried and it didn't work, but I'm no LaTeX expert. |
Beta Was this translation helpful? Give feedback.
-
That's great, @cscheid! Thank you for this feature! Is there a way to insert the bottom caption inside the Example:Pre-render (qmd)::: {#fig-mpg}
::: {.figure-content}
```{r}
#| label: fig-mpg
#| fig-height: 4
#| fig-width: 6
# library(datasets)
# library(ggExtra)
# library(ggplot2)
p <- ggplot2::ggplot(
datasets::mtcars, ggplot2::aes(x=wt, y=mpg, color=cyl, size=cyl)
) +
ggplot2::geom_point() +
ggplot2::theme(legend.position="none")
ggExtra::ggMarginal(
p, type="histogram",
fill = "slateblue",
xparams = list(bins=10)
)
```
:::
Source: Data extracted from the 1974 Motor Trend magazine and published by `@henderson1981`. Visualization by `@holtz`, available at [The R Graph Gallery](https://r-graph-gallery.com/277-marginal-histogram-for-ggplot2.html).
Relation between _weight (1000lbs)_ ($\text{wt}$) and _miles per galon_ ($\text{mpg}$) for combustion engine vehicles
::: Post-render (LaTeX)\begin{figure}[H]
\caption{\label{fig-mpg}Relation between \emph{weight (1000lbs)}
(\(\text{wt}\)) and \emph{miles per galon} (\(\text{mpg}\)) of for
combustion engine vehicles}
\centering{
\includegraphics{index_files/figure-pdf/unnamed-chunk-6-1.png}
Source: Data extracted from the 1974 Motor Trend magazine and published
by \textcite{henderson1981}. Visualization by \textcite{holtz},
available at
\href{https://r-graph-gallery.com/277-marginal-histogram-for-ggplot2.html}{The
R Graph Gallery}.
}
\end{figure} PDF outputSource: {abnt}: Quarto format for ABNT theses and dissertations. (Side question. How can I disable the subcaptions? This "(a)" above the chart keeps showing up) |
Beta Was this translation helpful? Give feedback.
-
In case this is still an issue for some, I made a small filter for the LaTeX use case here https://github.com/simonreif/notes-block. |
Beta Was this translation helpful? Give feedback.
In 1.4, you can do this instead:
The reason this works is that, semantically, the last paragraph of a div with
fig-*
identifier is its caption, and everything else before that is the figure content. But the placement of the caption is controlled byfig-cap-location
.