-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plot_trajectory
should correctly label corporate_economy
as "Corporate Economy" and projected
as "Portfolio"
#172
Comments
See reprex below: library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(r2dii.plot.static)
out1_trajectory <- tibble::tribble(
~year, ~metric_type, ~metric, ~value, ~technology,
2020L, "portfolio", "projected", 1, "renewablescap",
2020L, "scenario", "b2ds", 1, "renewablescap",
2020L, "scenario", "nps", 1, "renewablescap",
2020L, "scenario", "sds", 1, "renewablescap",
2025L, "portfolio", "projected", 1.1, "renewablescap",
2025L, "scenario", "b2ds", 1.3, "renewablescap",
2025L, "scenario", "nps", 1.1, "renewablescap",
2025L, "scenario", "sds", 1.2, "renewablescap",
2020L, "benchmark", "corporate_economy", 1, "renewablescap",
2025L, "benchmark", "corporate_economy", 1.55, "renewablescap"
)
scenario_specs <- tibble(
scenario = c("b2ds", "sds", "nps", "worse"),
color = c("#9CAB7C", "#FFFFCC", "#FDE291", "#E07B73"),
label = c("B2DS", "SDS", "NPS", "worse")
)
main_line_metric <- tibble(
metric = "projected",
label = "Portfolio"
)
additional_line_metrics <- tibble(
metric = "corporate_economy",
label = "Corporate Economy"
)
# notice here that the final value for "projected" is 1.1, and
# "corporate_economy" is 1.55
out1_trajectory %>%
filter(year == 2025) %>%
filter(metric %in% c("projected", "corporate_economy"))
#> # A tibble: 2 x 5
#> year metric_type metric value technology
#> <int> <chr> <chr> <dbl> <chr>
#> 1 2025 portfolio projected 1.1 renewablescap
#> 2 2025 benchmark corporate_economy 1.55 renewablescap
# however in this plot, we can see that the portfolio seems to end at 1.55, and
# corporate_economy at 1.1
plot_trajectory(
out1_trajectory,
scenario_specs_good_to_bad = scenario_specs,
main_line_metric = main_line_metric,
additional_line_metrics = additional_line_metrics
) Created on 2021-05-26 by the reprex package (v2.0.0) |
plot_trajectory
should correctly label corporate_economy
as "Corporate Economy" and projected
as "Portfolio"
@jdhoffa - with the new version of the plot_trajectory function (with annotations) this issue should be solved. Can you confirm? |
It seems like it is solved!! library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(r2dii.plot)
out1_trajectory <- tibble::tribble(
~year, ~metric_type, ~metric, ~value, ~technology,
2020L, "portfolio", "projected", 1, "renewablescap",
2020L, "scenario", "b2ds", 1, "renewablescap",
2020L, "scenario", "nps", 1, "renewablescap",
2020L, "scenario", "sds", 1, "renewablescap",
2025L, "portfolio", "projected", 1.1, "renewablescap",
2025L, "scenario", "b2ds", 1.3, "renewablescap",
2025L, "scenario", "nps", 1.1, "renewablescap",
2025L, "scenario", "sds", 1.2, "renewablescap",
2020L, "benchmark", "corporate_economy", 1, "renewablescap",
2025L, "benchmark", "corporate_economy", 1.55, "renewablescap"
)
scenario_specs <- tibble(
scenario = c("b2ds", "sds", "nps"),
label = c("B2DS", "SDS", "NPS")
)
main_line_metric <- tibble(
metric = "projected",
label = "Portfolio"
)
additional_line_metrics <- tibble(
metric = "corporate_economy",
label = "Corporate Economy"
)
# notice here that the final value for "projected" is 1.1, and
# "corporate_economy" is 1.55
out1_trajectory %>%
filter(year == 2025) %>%
filter(metric %in% c("projected", "corporate_economy"))
#> # A tibble: 2 x 5
#> year metric_type metric value technology
#> <int> <chr> <chr> <dbl> <chr>
#> 1 2025 portfolio projected 1.1 renewablescap
#> 2 2025 benchmark corporate_economy 1.55 renewablescap
# however in this plot, we can see that the portfolio seems to end at 1.55, and
# corporate_economy at 1.1
plot_trajectory(
out1_trajectory,
scenario_specs_good_to_bad = scenario_specs,
main_line_metric = main_line_metric,
additional_line_metrics = additional_line_metrics
) Created on 2021-06-02 by the reprex package (v2.0.0) |
@jdhoffa great! Although I see another problem of annotations overlap here since portfolio overlaps with scenario:/ I'll put it in a new issue. |
IMPORTANT: The reprex above does not actually highlight the issue.
Due to a bug in
r2dii.plot.static
, the labels for "Corporate Economy" and "Projected" are swapped, causing terrible confusion.The "Corporate Economy" in this case starts at
1
and ends at1.55
in both plots, as expected.Originally posted by @jdhoffa in https://github.com/2DegreesInvesting/r2dii.analysis/issues/269#issuecomment-848619268
The text was updated successfully, but these errors were encountered: