Quadrant chart

Overview

Shaded Quadrant chart is helpful when you want to show in an instance positions or proportions of points in each arbitrary fixed quadrant.

How to create a Quadrant chart?

  1. Add series and perform needed analyses.
  2. Add Scatter chart or Category scatter chart.
  3. On a chart navigate to Actions ribbon to Chart properties > Annotations and add Horizontal line and Vertical line on chart to divide your chart into four areas.
    • You don't have to add it ideally on point. After adding line you can click on it and change its position by typing right value in Line > Position.
  4. Then navigate to Chart properties > Chart ornaments > Text box and add four Text boxes.
    • Note! Text box will push out all other labels (point's labels) because for main-app it's the same type of object - but once you add all four Text boxes, labels will go above Text boxes and you will be able to move them freely.

Setting background colors

This has to be done for each Text box separately:

  1. To add color for Text box click on it, go to Presentation properties and check 'Custom style'.
  2. Click on Presentation properties > Appearance > Background > [...] icon.
  3. By default color is set to 'Solid' - if you don't want to change it, just select colors for quadrants. If you want quadrants to have gradients, change Color type to 'Gradient'.
  4. Select colors, opacity and gradient angle, for example:
    • Left-upper: #99FEA527 60%, #33FFFFFF 20%, angle 60 (orange-white),
    • Right-upper: #99008000 60%, #33FFFFFF 20%, angle 120 (green-white),
    • Left-down: #33FFFFFF 20%, #99B61818 60%, angle 120 (white-red),
    • Right-down: #33FFFFFF 20%, #99DCCD2E 60%, angle 60 (white-yellow).
  5. Under Presentation properties > Border > Border width select 'None'.

Examples

Social Progress Index vs GDP growth

In this example we showed relationship between Brent Oil price and US oil consumption.

Brent Oil Price vs US oil consumption

In this example we showed relationship between Brent Oil price and US oil consumption.

Hit rate

Calculate Hit rate for each quadrant.

 

Fan chart

Overview

Using Forecast analysis on multiple same series you can create a Fan chart from Time chart and show uncertainty associated with forecasts.

How to create a Fan chart?

  1. Add same series on Series list - as many times as you have predicted variants - plus one which will be the 'core' series.
  2. Change descriptions on Series list if needed.
  3. Add Forecast analysis, use 'Edit' to add forecast to each variant-series.
  4. If this is an Index (like in below example) you can add Rate of change analysis and create percentage series.
  5. Add Time chart, change colors or apply Style sheet.

Examples

Euro Area CPI

Different scenarios for future inflation added in Forecast analysis.

EUR per USD percentile distribution

We calculate the distribution with user-defined formula .prob() and present it with Fan chart. For more information see How formula with dot works? and User defined formulas.

Dumbbell chart

Overview

There is no dedicated chart type for Dumbbell charts. However, with Scalar/Cross sampling analyses  you can create it out of Bar chart.

How to create a Dumbbell chart?

  1. Use Scalar (or Cross sampling) with 'Calculations: Value at' for two points in time.
  2. Add Bar chart (after Scalar countries will be sorted alphabetically).
  3. Open Graph layout (Ctrl+L), arrange series:
    • turn the graph type to 'Range',
    • in left panel mark both series, use 'Add new Graph column', change the graph type to 'Markers' and drag it under first Graph,
    • mark series, use 'Add new Text column' > 'With value', drag it above Graph.
    • mark another series, use 'Add new Text column' > 'With value'.
    • Press 'OK'.

Adjusting chart elements

  1. Click on any range bar, change number under Graph properties > Content > Bar height.
  2. To change range bar color go to Graph properties > Appearance and change Graph style to Custom, select new color.
  3. Click on group of markers go to Graph properties > Appearance and change Graph style to Custom, select new color and size.
  4. Edit legend, main title and columns' titles.

Background graphic elements

  1. To add vertical line, click on one of them, under Grid line properties >Appearance change its color.
  2. To match x-axis' tick color, click on x-axis, go to Axis properties > Appearance > Tick color and change its color.
  3. To change background color go to Graph area properties > Row appearance > Background 1. To remove it put it to 'transparent color'.

Examples

Dumbbell chart (with lists)

In this example we have used Lists with HICP data and processed them with Scalar (or Cross sampling) to compare values for 2019 and 2022. Using lists make it easier to introduce changes - you make addition/deletion on a list, everything else stay the same.

Bar chart - dumbbell

In this example, we show simple sorted dumbbell chart based on High/Low values.

Slope chart

Overview

There is no dedicated chart type for Slope charts. However, with Scalar/Cross sampling analyses you can create slopes out of Category chart.

How to create a Slope chart?

  1. Use Scalar (or Cross sampling) with 'Calculations: Value at' for two (or more) points in time.
  2. Set 'Output series' to 'One series per input'.
  3. Rename 'Value labels'.
  4. Add Category chart.
  5. Add points on each end:
    • click on each line and under Presentation properties > Appearance > Graph style select 'Custom' select 'Marker style',
    • repeat that for all lines.

Cleaning graphical elements

  1. To remove '[scalar]' from legend's descriptions click outside chart area and under Presentation properties >Chart elements untick 'Analysis text'.
  2. Some things cannot be disabled but you can select for them 'transparent color', those are:
    • click on Y-axis, under Presentation properties > Appearance > Text color,
    • click on Y-axis, under Presentation properties > Appearance > Tick color,
    • click on Y-axis' description , under Presentation properties > Appearance > Text color,
    • click on X-axis, under Presentation properties > Appearance > Tick color.
  3. Disable other graphic elements from chart:
    • click on any grid line, under Presentation properties untick 'Show grid lines',
    • click inside chart area, under Presentation properties > Border > Sides select 'Bottom'.

Adding value labels on chart

  1. To add value label right-click on any dot, select 'Add observation label'.
  2. Click on it, under Presentation properties check Custom style:
    • under Anchor line > Width select 'None',
    • under Anchor appearance > Style select 'None'.
  3. Double-click on label's text. Leave only {s .Value}.

Now you can copy the label with Ctrl+c keys, click on any other dot, and paste label with Ctrl+v. It will keep the style of first label.

Example

Slope chart

In this example we calculated annual average CPI and showed its level on years 2019 and 2022.

Pie chart

Overview

The Pie chart lets you display category series. It can be added only after analyses which remove time parameter. It’s a good way to show proportions for few items.

Settings

The settings for the pie chart are different than for other charts.

Chart elements:

  1. Chart area
  2. Main title
  3. Legend
  4. Note(s)
  5. Slice (of Pie chart)
  6. Slice's label
  7. Source logo & text

After clicking on an element, several tabs appear in the ribbon area with different properties that you can edit. There are many settings to help customize the chart, so they are grouped under tabs and panels.

Changing default settings

Most properties have a default setting that is applied to the whole chart. You can override a default setting by editing specific elements. The new setting will make the field pinned and will no longer use the default value. You can go back to use the default value by unpinning the setting - 'blue pin' will be shown then vertically.

Chart properties

Here you can apply general settings for the whole chart. Among others you can control Appearance of the Pie chart.

Start angle

You can choose where the app should start drawing the first division line. From the list you can select 0/90/180/270 angle, but you can also insert your own number.

Radius

Here you can change size of the Pie chart.

Offset

If you decide to push out a slice of Pie chart, you can decide here how far away should it be. The value can be from 0 to 100.

To push the slice out, click on it and under Slice properties tab check box next to ‘Offset slice’.

Units

Units are automatically displayed in the top note. It's constructed using  dynamic text: {s .DisplayUnit -m}. To remove the units, double click on it, or go to Chart properties > Notes >Top, and remove the text.

Slice defaults

Here you can apply general settings for all slices regarding text and labels appearance.

Slice properties

This tab becomes available after clicking on an individual slice. You can change slice’s text and legend label content, select color, and decide if you want to offset the slice (push it out of the pie). To change how far away it should be, go to Chart properties > Appearance > Offset setting.

Label properties

Inside

Labels inside the Pie chart can be moved to a position between 0 (center of Pie chart) and 100 (outer line of Pie chart).

Outside

Outside labels work the same as regular labels. Instead of ‘Position’, they have a ‘Distance’ setting.

To remove them from chart, use Text > Edit default and delete text from there.

Main title properties / Legend properties

After clicking on one of these elements, you will see a separate tab with settings for it.

Graph layout

If you have created more than one data set (for example with Scalar or Cross sampling) you can choose here which one should be used for your Pie chart.

Style sheets

Pie charts have a separate tab in the Style sheet creator.

What analyses work with this chart type?

All types of analyses which remove time parameter and turn series into category series or use such series.

Examples

Life Satisfaction survey

We have created Pie charts with survey answers for different countries, with one slice popping from the pie. You can easily add more countries and quickly create new Pie charts.

Yes, No, Don’t know

The classic survey answers in a form of Pie chart.

Symbol chart from bar chart (mini pie charts)

Overview

Symbol charts in a form of mini pie charts are a feature available within Bar chart. They are designed to show the proportions of two series or magnitude of one value on a scale 0-100.

Settings

When you click on any element of the chart, several tabs appear in the ribbon area with different properties that you can edit. General settings are the same as in Bar chart.

Changing default settings

Most properties have a default setting that is applied to the whole chart. You can override a default setting by editing specific elements. The new setting will make field pinned and will no longer use the default value. You can go back to use the default value by unpinning the setting - 'blue pin' will be shown then vertically.

Graph layout

To add symbol chart open Graph layout (Ctrl+L), select series and on the right choose ‘Add new Symbol column’ button. It will be added as a separate column.

Graph properties

When you click on a mini pie chart you will see new tab with settings. You can change the text, color, and size of the pie.

Style sheet

To set the background color for mini pie charts go to Bar chart tab and select ‘Back Color’ on each Graph style.

Examples

China, energy mix

It shows proportions of two series. With Cross sampling we have created mini pie charts from each of energy-series and a total series.

Population above age 65 in South America

Simple mini pie charts showing percentage on a scale 0-100.

Seats held by women in parliaments across Europe

We have created a list with series and used Cross sampling to compare last value with the one from 10 year ago. Additionally, there’s a column with value for difference. We applied colors based on Rules to it.

Lollipop chart from bar chart

Overview

You can create lollipop chart by modifying Bar chart.

How to create a lollipop chart?

  1. Open Graph layout (Ctrl+L).
  2. Under 'Bar' leave one series.
  3. In the left panel select that series and from above choose 'Marker'.
  4. Close Graph layout.
  5. Click on one of the bars and under Graph properties > Content > Bar height, and change the value there.

Example

Bar chart - lollipop

In this example, we calculated Rate of change and then constructed lollipops with graph styles available for Bar charts.

Choropleth map (incl. automated search)

Macrobond R API is available for users with Data+ and Legacy license (the latter without searching and revision history functions). Example was tested on Macrobond version 1.27, Macrobond API for R version 1.2-8 and R 4.2.0.

See method of constructing choropleth map - with ggplot2 and sf - based on a shape file. Example is presented on World Development Indicator - Population Ages 65 & Above data from World Bank. Jump to the code.

Map created with ggplot2 and sf packages. Search query is based on concept metadata. You only need code for one series and the rest is downloaded automatically. To see not-based-on-search method see Circular bar chart method.

Based on a shape file, with 'search by concept', ggplot2 + sf packages

library(MacrobondAPI)
library(tidyverse)
library(countrycode)
library(sf) #for map's shape
library(broom)
library(viridis) #for colors

###DATA PART
#choose series
series<-FetchOneTimeSeries("af_sp_pop_65up_to_zs")
#get the concept of a series and create search query based on it
query <- CreateSearchQuery() 
setEntityTypeFilter(query, "TimeSeries") 
addAttributeValueFilter(query, "RegionKey", getConcepts(series)) 
country_set <- getEntities(SearchEntities(query))

#create empty vectors
list_of_series<-NULL
values<-NULL
ISO2<-NULL
country<-NULL

#get list of series' codes
for (i in country_set){
  list_of_series<-append(list_of_series, getName(i))
}

#get last values 
for (i in list_of_series){
  values<-append(values, last(getValues(FetchOneTimeSeries(i))))
}

#get countries ISO codes
for (i in list_of_series){
  ISO2<-append(ISO2, getMetadataValues(getMetadata(FetchOneTimeSeries(i)), "Region"))
}

#change ISO codes to country names
country<-countrycode(as.vector(ISO2), origin="iso2c", destination ="country.name")

#prepare data frame
data <- data.frame(values, ISO2, country) %>%
  drop_na() %>%
  mutate(ISO2=str_to_upper(ISO2)) #shape file has ISO codes in upper cases


###MAP INFO PART (based on a shape file)
#This example uses shape file from: http://thematicmapping.org/downloads/TM_WORLD_BORDERS_SIMPL-0.3.zip

#Read shape file with the sf library. You'll get a data frame.
map <- st_read("C:/Users/name.name/Desktop/R/DATA", 
layer="TM_WORLD_BORDERS_SIMPL-0.3")

###DATA + MAP
#join map info and data
map_final <- full_join(map , data, by="ISO2")

#plot
ggplot() +
  geom_sf(data = map_final, colour = "black", size = 0.2, aes(fill = values)) +
  theme_void()+
  ggtitle("Percentage of population ages 65 and above")+
  scale_fill_viridis(option="D", direction=-1, #color scale's & legend's settings
                     breaks=c(5,10,15,20,25,30,35), 
                     name=" %")+
  theme(plot.title=element_text(size=rel(1.5), hjust=0.5), #additional settings for title and legend
        legend.position=c(0.15, 0.35))

Radar chart

Macrobond R API is available for users with Data+ and Legacy license (the latter without searching and revision history functions). Examples were tested on Macrobond version 1.27, Macrobond API for R version 1.2-8 and R 4.3.0.

See two methods of constructing radar charts - with ggplot2 + ggradar and fsmb. Examples are presented on Innovation Input Sub-index from Global Innovation Index.

 

Radar chart version 1 created with ggplot2 and ggradar packages (click to enlarge). Jump to code with ggplot2 + ggradar package.

 

 

 


Radar chart version 2 with fmsb package (click to enlarge). Jump to code with fmsb package.

 

With ggplot2 + ggradar

library(MacrobondAPI)
library(tidyverse)
library(countrycode)
library(ggradar)

#First column is the name of the groups and each column represents a variable.
#All columns must have the same scale.
#If the values of your columns are not between 0 and 1 you will need to specify the minimum value with grid.min and the maximum value with grid.max.

#create list of series
list_of_series<-c("gii0828", "gii0974", "gii1266", "gii0682", "gii1120", #Nigeria
                  "gii0849", "gii0995", "gii1287", "gii0703", "gii1141", #South Africa
                  "gii0773", "gii0919", "gii1211", "gii0627", "gii1065") #Ethiopia

#create empty vectors
values<-NULL
region<-NULL

#get region
for (i in list_of_series){
  region<-append(region, getMetadataValues(getMetadata(FetchOneTimeSeries(i)), "Region"))
}
#change region ISO codes to names
region<-countrycode(as.vector(region), origin="iso2c", destination ="country.name")

#set description
description_labels<-c("Human Capital & Research", "Infrastructure", "Business \nSophistication", 
                      "Institutions", "Market \nSophistication")
descriptions<-rep(description_labels, 3) #create this for data frame

#get values 
for (i in list_of_series){
  values<-append(values, last(getValues(FetchOneTimeSeries(i))))
}

#prepare data frame
data <- data.frame(region, descriptions, values)
#change format of data from long to wide
data <- spread(data, descriptions, values)

#set colors
colors <- c("#58A291", "#F68D2E", "#CD545B")

#plot
ggradar(data, 
        values.radar = c(0, 40, 80), #0%, 50%, 100% of values
        axis.labels = c(description_labels), #description of each 'arm'
        grid.min=0,grid.mid=40, grid.max=80, #grid labels
        background.circle.colour = "white", #background settings
        axis.line.colour = "grey", #axis line's settings
        axis.label.size=4,
        gridline.min.colour = "grey", #gridlines' settings
        gridline.mid.colour = "grey",
        gridline.max.colour = "grey",
        grid.label.size=5,
        group.colours = colors, #chart's lines settings
        group.line.width= 1.2,
        group.point.size=5,
        legend.title="Global Innovation Index", #legend's settings
        legend.position = "top", 
        legend.text.size = 10)

With fmsb

library(MacrobondAPI)
library(tidyverse)
library(countrycode)
library(fmsb)

#create list of series
list_of_series<-c("gii0828", "gii0974", "gii1266", "gii0682", "gii1120", #Nigeria
                  "gii0849", "gii0995", "gii1287", "gii0703", "gii1141", #South Africa
                  "gii0773", "gii0919", "gii1211", "gii0627", "gii1065") #Ethiopia

#create empty vectors
values<-NULL
region<-NULL

#get region
for (i in list_of_series){
  region<-append(region, getMetadataValues(getMetadata(FetchOneTimeSeries(i)), "Region"))
}
#change ISO codes to names
region<-countrycode(as.vector(region), origin="iso2c", destination ="country.name")

#set description
description_labels<-c("Human Capital & Research", "Infrastructure", "Business \nSophistication", 
                      "Institutions", "Market \nSophistication")
descriptions<-rep(description_labels, 3) #create this for data frame

#get values 
for (i in list_of_series){
  values<-append(values, last(getValues(FetchOneTimeSeries(i))))
}

#Data frame must have first row representing the maximum values of the data and the second row the minimum values.
#prepare data frame
data <- data.frame(region, descriptions, values)
#prepare data frame for max and min values
max_min <- as.data.frame(rbind(rep(80, 5), rep(0, 5)))
rownames(max_min) <- c("max", "min")
colnames(max_min) <- description_labels
                      
#change format of data from long to wide
data <- spread(data, descriptions, values) %>%
  column_to_rownames(var="region") #move first column to row names
data <- rbind(max_min, data) #join two data frames

#set colors
colors <- c("#58A291", "#F68D2E", "#CD545B")

#plot (mark radar chart and legend to plot them together)
radarchart(data, 
           axistype=1, #gridlines' settings
           cglcol = "gray", 
           axislabcol="grey", 
           caxislabels=c(0,20, 40, 60, 80), 
           pcol = colors, #chart's lines settings
           plty = 1,
           plwd = 2,
           vlcex=0.8, #size of value labels
           title = "Global Innovation Index") 

legend(x=1.3, y=1, #legend's position
       legend = rownames(data[-c(1,2),]), #exclude names for max and min
       bty="n", #border around legend, n=none
       pt.cex=1.8, #width of sample colors
       pch = 20,
       col = colors)