-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_plot.qmd
86 lines (64 loc) · 2.3 KB
/
simple_plot.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: "Simple R Example"
date: "2024-09-23"
output: html
execute:
echo: true
---
# This is a very basic quarto document for sharing your code
This is a simple example of how to create a bar plot in R using ggplot2.
```{r}
# Load necessary library
library(ggplot2)
# Create a simple dataset
data <- data.frame(
category = c("A", "B", "C", "D"),
values = c(3, 7, 9, 4)
)
# Create a bar plot
ggplot(data, aes(x = category, y = values)) +
geom_bar(stat = "identity", fill = "steelblue") +
theme_minimal() +
labs(title = "Simple Bar Plot", x = "Category", y = "Values")
```
::: {.callout-note}
You can create a callout note by using the `callout-note` class.
:::
Show some data your map
```{r}
# Load required packages
library(leaflet)
library(leaflet.extras) # Provides heatmap functionality
# Define the latitude and longitude for Seattle, WA
seattle_coords <- c(47.6062, -122.3321)
# Generate some sample data around the Seattle area
set.seed(123) # for reproducibility
lat <- rnorm(100, mean = 47.6062, sd = 0.01) # latitude around Seattle
lng <- rnorm(100, mean = -122.3321, sd = 0.01) # longitude around Seattle
intensity <- rnorm(100, mean = 1, sd = 0.5) # sample intensity values
# Create a data frame for heatmap
heatmap_data <- data.frame(lat, lng, intensity)
# Create the Leaflet map
leaflet() %>%
addTiles() %>% # Add default OpenStreetMap tiles
setView(lng = seattle_coords[2], lat = seattle_coords[1], zoom = 12) %>%
addHeatmap(
lng = heatmap_data$lng,
lat = heatmap_data$lat,
intensity = heatmap_data$intensity,
blur = 20, max = 1, radius = 15
)
```
::: {.callout-tip}
You can create callout-tips! Just use the `callout-tip` class.
:::
Quarto supports LaTeX-style math for rendering mathematical equations in documents. This type of math can be used to display both inline math expressions and block (display) math expressions. For example, the equation $E=mc^2$ is an example of inline math, while the equation $$ A = \pi r^2 $$ is the example of block math.
You can use mermaid to create diagrams in your documents. For example, the following code creates a simple flowchart:
```{mermaid}
graph TD;
A[Start] --> B[Step 1];
B --> C[Step 2];
C --> D[End];
```
If you want to learn more, check this video:
{{< video https://youtu.be/_f3latmOhew?si=HE6bpTObWfmnAZzM >}}