From 75e4a8ffd4bdd2cd9b9ab82fe36a0c7c6229a2d4 Mon Sep 17 00:00:00 2001 From: Andy Teucher Date: Mon, 26 Aug 2024 13:40:57 -0700 Subject: [PATCH] Align colour schemes in instance type plots (#16) --- aws-usage-report/aws-usage-report.qmd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aws-usage-report/aws-usage-report.qmd b/aws-usage-report/aws-usage-report.qmd index f754af8..d390a83 100644 --- a/aws-usage-report/aws-usage-report.qmd +++ b/aws-usage-report/aws-usage-report.qmd @@ -399,7 +399,7 @@ ec2_usage_plot <- ggplot(ec2_usage_data, aes(x = start_date, y = UsageQuantity, ```{r daily-cost-by-instance} ec2_cost_data <- ec2_instance_type_costs_usage |> - mutate(instance_type = fct_reorder(instance_type, UnblendedCost, .fun = max)) + mutate(instance_type = factor(instance_type, levels = levels(ec2_usage_data$instance_type))) ec2_cost_plot <- ggplot(ec2_cost_data, aes(x = start_date, y = UnblendedCost, fill = instance_type)) + @@ -427,7 +427,8 @@ ec2_instance_data <- ec2_instance_type_costs_usage |> summarize( total_hours = sum(UsageQuantity), total_cost = sum(UnblendedCost) - ) + ) |> + mutate(instance_type = factor(instance_type, levels = levels(ec2_cost_data$instance_type))) ggplot(ec2_instance_data, aes(x = total_hours, y = total_cost, colour = instance_type)) + geom_point(size = 3) +