Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
royfrancis committed Mar 17, 2024
1 parent 2e98d42 commit 766b941
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 85 deletions.
1 change: 0 additions & 1 deletion documents/ojs-linked/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ date: last-modified
date-format: "DD-MMM-YYYY"
format:
html:
theme: materia
fig-align: left
title-block-banner: true
code-tools: true
Expand Down
57 changes: 12 additions & 45 deletions documents/ojs-plots/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ date: last-modified
date-format: "DD-MMM-YYYY"
format:
html:
theme: materia
page-layout: full
fig-align: left
title-block-banner: true
code-tools: true
Expand Down Expand Up @@ -55,8 +55,8 @@ viewof tbl_mtcars = Inputs.table(mtcars)
```{r}
#| filename: R
ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
geom_text(nudge_x = 0.05)
ggplot(mtcars, aes(wt, mpg, col = cyl)) +
geom_point()
```

:::
Expand All @@ -66,53 +66,20 @@ ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
```{ojs}
//| filename: OJS
Plot.plot({
plot_data = Plot.plot({
color: { legend: true},
marks: [
Plot.text(
mtcars,
{ x: "wt", y: "mpg", text: "vehicle", textAnchor: "start" }
)
Plot.dot(mtcars, {
x: "wt",
y: "mpg",
fill: "cyl",
tip: true,
channels: { Name: "_row" }
})
],
grid: true
})
```
:::
:::


### With categorical colors

::: {.grid}
::: {.g-col-6}

```{r}
#| filename: R
ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
geom_text(aes(colour = factor(cyl)))
```
:::

::: {.g-col-6}

```{ojs}
//| filename: OJS
Plot.plot({
color: {
type: "ordinal",
range: [ "#88a2bc", "#d99477", "#586c5c"],
legend: true
},
marks: [
Plot.text(
mtcars.map(d => { d.cyl = `${d.cyl}`; return d }),
{ x: "wt", y: "mpg", text: "vehicle", fill: "cyl" }
)
],
grid: true
})
```
:::
:::
Expand Down
17 changes: 16 additions & 1 deletion documents/ojs-widgets/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ date: last-modified
date-format: "DD-MMM-YYYY"
format:
html:
theme: materia
fig-align: left
title-block-banner: true
toc: true
Expand Down Expand Up @@ -277,10 +276,15 @@ function downloadHtmlAsImage(el, options) {
}
```

Download an image as PNG.

```{ojs}
downloadHtmlAsImage(barplot)
```

Adjust the scale parameter.


```{ojs}
downloadHtmlAsImage(barplot, {
label: "Download 4X PNG",
Expand All @@ -289,6 +293,17 @@ downloadHtmlAsImage(barplot, {
})
```

Download image as SVG.

```{ojs}
import {serialize} from "@mbostock/saving-svg"
import {rasterize} from "@mbostock/saving-svg"
```

```{ojs}
DOM.download(() => serialize(barplot), undefined, "Save as SVG")
```

### Zip download

```{ojs}
Expand Down
1 change: 0 additions & 1 deletion documents/ojs/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ date: last-modified
date-format: "DD-MMM-YYYY"
format:
html:
theme: materia
fig-align: left
title-block-banner: true
code-tools: true
Expand Down
2 changes: 0 additions & 2 deletions documents/param-text/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ date: 08-Oct-2023
format:
html:
title-block-banner: true
theme: pulse
highlight: kate
code-tools: true

params:
Expand Down
2 changes: 0 additions & 2 deletions documents/report/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ format:
title-block-banner: true
toc: true
number-sections: true
theme: pulse
highlight: kate
code-tools: true
fig-align: left

Expand Down
1 change: 0 additions & 1 deletion documents/shinylive/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ author: "Roy Francis"
date: last-modified
format:
html:
theme: materia
title-block-banner: true
toc: true
number-sections: true
Expand Down
19 changes: 0 additions & 19 deletions documents/theme-title/index.qmd

This file was deleted.

1 change: 0 additions & 1 deletion documents/webr/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ date: last-modified
date-format: "DD-MMM-YYYY"
format:
html:
theme: materia
fig-align: left
title-block-banner: true
toc: true
Expand Down
38 changes: 26 additions & 12 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,40 @@ format:
---

## Parameterized outputs
### [Parameterized html report](documents/report/index.qmd)
### [Parameterized html revealjs presentation](documents/revealjs/index.qmd)
### [Parameterized pdf](documents/pdf/index.pdf)
### [Parameterized html report from external file](documents/param-text/index.qmd)

In parameterized reports, one or more parameters used in the document are provided to the document at the time of rendering.

- [Parameterized html report](documents/report/index.qmd)
- [Parameterized html revealjs presentation](documents/revealjs/index.qmd)
- [Parameterized pdf](documents/pdf/index.pdf)
- [Parameterized html report from external file](documents/param-text/index.qmd)

## OJS
### [OJS and R](documents/ojs/index.qmd)
### [OJS widgets, upload and download](documents/ojs-widgets/index.qmd)
### [OJS and ggplot plots](documents/ojs-plots/index.qmd)
### [OJS linked plots](documents/ojs-linked/index.qmd)

[Observable Plot](https://observablehq.github.io/plot/) is a javascript framework for exploratory data visualization. OJS is supported natively in quarto. Read more about OJS in quarto [here](https://quarto.org/docs/interactive/ojs/).

- [OJS and R](documents/ojs/index.qmd)
- [OJS widgets, upload and download](documents/ojs-widgets/index.qmd)
- [OJS and ggplot plots](documents/ojs-plots/index.qmd)
- [OJS linked plots](documents/ojs-linked/index.qmd)

## WebR
### [WebR in HTML report using Quarto webr extension](documents/webr/index.qmd)
### [WebR in RevealJS presentation](documents/webr-revealjs/index.qmd)

[WebR](https://docs.r-wasm.org/webr/latest/) allows to run R in the browser. Try out a [demo](https://webr.r-wasm.org/latest/) of R IDE running in the browser. R packages need to be specifically compiled for use with webr. He is the current list of [webr R packages](https://repo.r-wasm.org).

- [WebR in HTML report using Quarto webr extension](documents/webr/index.qmd)
- [WebR in RevealJS presentation](documents/webr-revealjs/index.qmd)
- Intro to WebR & Shinylive by George Stagg: <https://www.youtube.com/watch?v=GlZKReTx8GA>

## Shinylive
### [Shiny in the browser](documents/shinylive/index.qmd)

Shinylive allows shiny applications to run in the browser wthout the need for a Shiny server. Shinylive is available for R and Python.

- [Shiny app in the browser](documents/shinylive/index.qmd)

## Other
### [Icons in quarto](documents/icons/index.qmd)

- [Icons in quarto](documents/icons/index.qmd)

<br>

Expand Down

0 comments on commit 766b941

Please sign in to comment.