JGCRI / rmap

Mapping software with pre-loaded global and local maps
https://jgcri.github.io/rmap/
Other
7 stars 0 forks source link

Enable scenario ordering for diff plots #93

Open jayfuhrman opened 1 year ago

jayfuhrman commented 1 year ago

I am able to use factor() to set the scenario or chart order successfully with regular plots. However, the diff plots default to alphabetical order, and when I attempt to use factor() to set the order explicitly, I get the following error:

prim_en_map <- prim_en_map %>%
+     mutate(scenario = factor(scenario, levels = c("2015 primary energy","GCAM-core","dynamic CCS","growth rate constraints")))
> rmap::map(data=prim_en_map,
+           folder = dir,
+           palette = "pal_hot",
+           scenRef = "2015 primary energy",
+           paletteDiff = 'pal_div_RdBl',
+           scenDiff = c("GCAM-core","dynamic CCS","growth rate constraints"),
+           ncol=1,
+           diffOnly=T,
+           title = 'Difference in 2050 Fossil Primary Energy Fraction relative to 2015') -> b
Starting map...
scenRef chosen: 2015 primary energy is not in any of the available scenarios:
3, 1, 2, 4
Setting scenRef to first scenario: 3.
None of the scenDiff are in any of the available scenarios:
1, 2, 4
Skipping Diff.
map run completed.
PaulWolfram commented 8 months ago

Trying to use the mapGCAMReg32 template as follows:

rmap::map(h2_p_reg,
+           underLayer = rmap::mapGCAMReg32,
+           background = T, 
+           ncol = 1,
+           legendType = "continuous",
+           title = "2050 industrial hydrogen price (2019$/GJ)")

It throws the following error: subRegions in data not present in shapefile are: EU-12, EU-15. Is there a fix for this? Many thanks in advance!

zarrarkhan commented 8 months ago

Hi Paul,

Can you try renaming your subRegions EU_12, EU_15 and see if that helps?

Best

Zarrar

On Wed, Jan 31, 2024 at 1:17 PM Paul Wolfram @.***> wrote:

Trying to use the mapGCAMReg32 template as follows:

rmap::map(h2_p_reg,

  • underLayer = rmap::mapGCAMReg32,
  • background = T,
  • ncol = 1,
  • legendType = "continuous",
  • title = "2050 industrial hydrogen price (2019$/GJ)")

It throws the following error: subRegions in data not present in shapefile are: EU-12, EU-15. Is there a fix for this? Many thanks in advance!

— Reply to this email directly, view it on GitHub https://github.com/JGCRI/rmap/issues/93#issuecomment-1919662196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB37WSZYQTPSCARRMTB3ORDYRKDCLAVCNFSM6AAAAAAWVVIXQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJZGY3DEMJZGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

PaulWolfram commented 8 months ago

That did the trick indeed. Many thanks @zarrarkhan!