Create a professional looking chart, using a pre-defined BETS series or a custom series.
chart(ts, style = "normal", file = NULL, open = TRUE, lang = "en",
params = NULL)
A character
or a ts
object. A custom time series or the name of a pre-defined series. A complete list of names is under the 'Details' section.
A character
. Should the chart be made with Plotly (style = "plotly") or with R standard library (style = "normal")?
A character
. The whole path, including a custom name, for the output (an image file). The default value is NULL. If left to NULL, the chart will be rendered in the standard R plotting area.
A boolean
. Whether to open the file containing the chart.
A character
. The language. For now, only 'en' (english) is available.
A list
. Parameters for drawing custom charts. See the 'details' section.
If parameter file
is not set by the user, the chart will be shown at the standard R ploting area. Otherwise, it is going to be saved on your computer.
Names of pre-defined charts:
1. Business Cycle Dashboard ('plotly' style)
VALUE | DESCRIPTION | CODE |
'iie_br' | Uncertainty Index | ST_100.0 |
'sent_ind' | Economic Sentiment Index (average between several confidence indexes) | (*) |
'gdp_mon' | GDP Monthly and Interanual Variation (last values) - GDP Monitor (FGV/IBRE) | (*) |
'ei_vars' | Economic Indicators (Leading and Coincident) monthly variation | (*) |
'ei_comps' | Economic Indicators (Leading and Coincident) components variation | (*) |
'lei' | Leading Economic Indicator (LEI - FGV/IBRE with The Conference Board) | (*) |
'cei' | Coincident Economic Indicator (CEI - FGV/IBRE with the Conference Board) | (*) |
'gdp_vars' | GDP components variation (whole series) - GDP Monitor (FGV/IBRE) | (*) |
'misery_index | Misery Index | 13522 plus 24369 |
'gdp_comps' | GDP components variation (last values) - GDP Monitor (FGV/IBRE) | (*) |
'gdp_unemp' | GDP monthly levels versus Unemployement Rate | 22109 and 24369 |
'conf_lvl' | Enterprises Confidence Index versus Consumers Confidence Index | (*) |
'inst_cap' | Installed Capacity Index | (*) |
'lab_lead' | Labor Leading Indicator | (*) |
'lab_coin' | Labor Coincident Indicator | (*) |
'transf_ind' | Transformation Industry Confidence Index (Expectations versus Present Situation) | (*) |
'servc' | Services Confidence Index (Expectations versus Present Situation) | (*) |
'constr' | Construction Confidence Index (Expectations versus Present Situation) | (*) |
'retail' | Retail Sellers Confidence Index (Expectations versus Present Situation) | (*) |
2. Macro Situation Dashboard ('normal' style)
VALUE | DESCRIPTION | CODE |
'ipca_with_core' | National consumer price index (IPCA) - in 12 months and Broad national consumer price index - Core IPCA trimmed means smoothed | 13522 and 4466 |
'ulc' | Unit labor cost - ULC-US$ - June/1994=100 | 11777 |
'eap' | Economically active population | 10810 |
'cdb' | Time deposits (CDB/RDB-preset) - Daily return (percentage) | 14 |
'indprod' | Prodcution Indicators (2012=100) - General | 21859 |
'selic' | Interest rate - Selic accumulated in the month in annual terms (basis 252) | 4189 |
'unemp' | Unemployment rate - by metropolitan region (PNAD-C) | 10777 |
(*) Not available on BETS databases yet. But you can find it in .csv files saved under your BETS installation directory.
3. Custom Charts
None of these parameters is required. Please note that some parameters only work for a certain type of chart.
PARAMETER | DESCRIPTION | WORKS FOR |
type |
A character . Either 'bar' or 'lines'. Whether to plot bars or lines. Works for main series, only. |
Both |
trend |
A boolean . Default is FALSE . Set it to TRUE if the trend of the main series (parameter ts ) is to be drawn. |
Both |
title |
A character . Plot's title. |
Both |
subtitle |
A character . Plot's subtitle. |
Both |
xlim |
A numeric vector. X axis limits |
Both |
ylim |
A numeric vector. Y axis limits |
Both |
arr.ort |
A character . Orientation of the arrow pointing to the last value of the main series. Valid values are 'h' (horizontal) and 'v' (vertical). |
'normal' |
arr.len |
A numeric value. Length of the arrow pointing to the last value of the main series. |
'normal' |
extra |
A ts object. A second series to be plotted. |
Both |
extra.y2 |
A boolean . Default is FALSE . Does the extra series require a second y axis? |
'plotly' |
extra.arr.ort |
A character . Orientation of the arrow pointing to the last value of the extra series. Valid values are 'h' (horizontal) and 'v' (vertical). |
'normal' |
extra.arr.len |
A numeric value. Length of the arrow pointing to the last value of the extra series. |
'normal' |
colors |
A character or integer vector. A vector of colors, one for each series. Trends will always be drawn in gray, its color can't be set. |
Both |
legend |
A character vector. Names of the series. Default is NULL (no legends). |
Both |
legend.pos |
A character . Legend position. If type is set to 'normal', possibile values are 'top' and 'bottom'; if type is set to 'plotly', either 'h' (horizontal) and 'v' (vertical). |
Both |
codace |
A boolean . Default is FALSE . Include shaded areas for recessions, as dated by CODACE(**)? |
'plotly' |
(**) Business Cycle Dating Committee (FGV/IBRE)
# NOT RUN {
# chart(ts = "sent_ind", file = "animal_spirits", open = T)
# chart(ts = "gdp_mon", file = "gdp_mon.png", open = F)
# chart(ts = "misery_index")
# chart(ts = "transf_ind", file = "transf_ind.png", open = F)
# }
Run the code above in your browser using DataLab