Skip to content

Commit

Permalink
Add consumption graphs (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianalexmac authored Jul 31, 2024
1 parent 697687d commit 97a8415
Show file tree
Hide file tree
Showing 3 changed files with 438 additions and 4 deletions.
38 changes: 38 additions & 0 deletions consumption.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,44 @@ Statewide electricity consumption growth for the residential sector was `r state

<!-- [^1]: For EIA reported data, the Other group includes industrial and transportation customers. For PCE reported data, it includes community and government accounts. No industrial accounts were reported in the PCE data. -->

```{r}
# Plot for statewide change in sales (html and pdf code)
sales_plot <-
ggplot(
statewide_delta,
aes(
x = sales_delta_percent,
y = reorder(class, sales_delta),
fill = class)) +
geom_bar(stat = "identity") +
geom_vline(xintercept = 0, color = "black") + # Add a vertical line at x = 0
scale_x_continuous(
name = "Percent Change",
breaks = seq(-12, 1, 2),
expand = c(0, 0.1)) +
scale_y_discrete(
name = "",
expand = c(0, 0.1)) +
scale_fill_manual(
values = c(
"Other" = "#fad900",
"Residential" = "#0084c1",
"Commercial" = "#e29617")) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid.major.y = element_blank(),
panel.grid.minor = element_blank()
)
```

```{r, eval=knitr::is_html_output()}
#| label: fig-change-customer-sales
Expand Down
8 changes: 4 additions & 4 deletions prices.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ library(ggrepel) # labels on ends of lines
library(ggdist) # raincloud plots
library(ggrain) # other raincloud package
weighted_prices <- read_csv("./data/working/prices/weighted_prices.csv")
prices <- read_csv("./data/working/prices/prices.csv")
weighted_prices <- read_csv("./data/final_data/weighted_prices.csv")
prices <- read_csv("./data/final_data/prices.csv")
# Function declaration
source("scripts/inline_functions/price_inline_functions.R")
Expand All @@ -43,8 +43,8 @@ d3 = require("d3@7")
import {tidy, groupBy, rename, summarize, sum, mutate, select, n, nDistinct, mean, filter, pivotWider, pivotLonger, leftJoin, slice} from "@pbeshai/tidyjs"
// load data
prices = FileAttachment("data/working/prices/prices.csv").csv({typed: true});
weighted_prices = FileAttachment("data/working/prices/weighted_prices.csv").csv({typed: true});
prices = FileAttachment("data/final_data/prices.csv").csv({typed: true});
weighted_prices = FileAttachment("data/final_data/weighted_prices.csv").csv({typed: true});
```
:::
Expand Down
Loading

0 comments on commit 97a8415

Please sign in to comment.