I want to construct a bar char for the following data, but I am having a problem with Missing[]
:
countries = {"Afghanistan", "Bangladesh", "Bhutan", "India",
"Maldives", "Nepal", "Pakistan", "Sri Lanka", "Brunei Darussalam",
"Cambodia", "Indonesia", "Laos", "Malaysia", "Myanmar",
"Philippines", "Singapore", "Thailand", "Timor-Leste", "Vietnam",
"China", "Japan", "Mongolia", "North Korea", "South Korea",
"American Samoa", "Fiji", "French Polynesia", "Guam",
"Hong Kong SAR, China", "Kiribati", "Marshall Islands",
"Micronesia", "Nauru", "New Caledonia", "Northern Mariana Islands",
"Palau", "Papua New Guinea", "Samoa", "Solomon Islands", "Tonga",
"Tuvalu", "Vanuatu", "Australia", "New Zealand"};
sAsia = {"Afghanistan", "Bangladesh", "Bhutan", "India", "Maldives",
"Nepal", "Pakistan", "Sri Lanka"};
seAsia = {"Brunei Darussalam", "Cambodia", "Indonesia", "Laos",
"Malaysia", "Myanmar", "Philippines", "Singapore", "Thailand",
"Timor-Leste", "Vietnam"};
eAsia = {"China", "Japan", "Mongolia", "North Korea", "South Korea"};
SIDS = {"American Samoa", "Fiji", "French Polynesia", "Guam",
"Hong Kong SAR, China", "Kiribati", "Marshall Islands",
"Micronesia", "Nauru", "New Caledonia", "Northern Mariana Islands",
"Palau", "Papua New Guinea", "Samoa", "Solomon Islands", "Tonga",
"Tuvalu", "Vanuatu"};
Pacific = {"Australia", "New Zealand"};
data19 = {2.55, 8.05, 4.05, 5.25, 7.55, 7.15, 3.7, 2.8, 2, 7.25, 5.1,
5.5, 4.55, 6.6, 6.15, 2.4, 3.25, 0.35, 7.05, 6.25, 0.45, 6.2,
Missing[], 2.45, Missing[], 1.7, Missing[], Missing[], 0.8, 3.85,
4.8, 0.7, 3.35, Missing[], Missing[], 2, 2.8, 0.75, 2.55, 0.5, 4.6,
3.1, 2.35, 2.9};
data20 = {-5, 3.8, -0.8, -8, -32.2, -1.9, -0.4, -3.6,
1.2, -3.5, -2.1, -0.4, -5.6, 3.2, -9.5, -5.4, -6.1, -6.8, 2.9,
2.3, -4.8, -5.3, Missing[], -1, Missing[], -19, Missing[],
Missing[], -6.1, -0.5, -3.3, -1.6, 0.7, Missing[],
Missing[], -10.3, -3.9, -3.2, -4.3, -0.5, 0.5, -9.2, -2.4, -3};
data = {data19, data20};
names = {"2019", "2020"};
ds = Dataset@Map[AssociationThread[names, #] &]@Transpose[data]
I like to use the database ds
in constructing special charts in: https://mathematica.stackexchange.com/a/249707/60365
Initially, I gave the data as a list of lists and I had no problem. But now because of the Missing[]
observations in my data, I realized that using the database ds
is more advantagous but then I am stuck with how touse ds
in the code
given in the above link.
Select[FreeQ[_Missing]]@ds
? $\endgroup$DeleteMissing[ds, 1, Infinity]
? $\endgroup$Missing[]
) in the chart by replacingdata
withDeleteMissing[ds, 1, Infinity]
. When I do this, the predefined groupspreProcess[{8, 11, 5, 18, 2}]
may pose problems. I wanted to have no arrow bar (empty space) for the missing countries but keep the country names on the X-axis. This way I can control the countries with missing values. $\endgroup$arrowBar
. $\endgroup$