Skip to content
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

About Waffle Bar Charts with scales #92

Open
junjun987 opened this issue Oct 18, 2022 · 0 comments
Open

About Waffle Bar Charts with scales #92

junjun987 opened this issue Oct 18, 2022 · 0 comments

Comments

@junjun987
Copy link

junjun987 commented Oct 18, 2022

Hi, I want to use "waffle bar chart with scales" to show my data, but I met some problems.
This is a data example I want to show. I want to classified by cause_id, and the value is "us" displayed in data to show by just waffle bar charts with scales.
This is an example code

example<-structure(list(year = c(1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 
1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 
1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 
1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 
1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1991L, 1991L, 
1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 
1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 
1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 
1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 
1991L, 1991L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 
1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 
1992L, 1992L, 1992L, 1992L), age_name = c("15-19 years", "50-54 years", 
"45-49 years", "30-34 years", "40-44 years", "35-39 years", "30-34 years", 
"55-59 years", "60-64 years", "20-24 years", "55-59 years", "50-54 years", 
"45-49 years", "30-34 years", "40-44 years", "35-39 years", "20-24 years", 
"15-19 years", "60-64 years", "20-24 years", "40-44 years", "50-54 years", 
"45-49 years", "35-39 years", "25-29 years", "35-39 years", "25-29 years", 
"55-59 years", "50-54 years", "15-19 years", "45-49 years", "55-59 years", 
"60-64 years", "20-24 years", "60-64 years", "40-44 years", "25-29 years", 
"25-29 years", "30-34 years", "15-19 years", "30-34 years", "30-34 years", 
"45-49 years", "55-59 years", "45-49 years", "50-54 years", "40-44 years", 
"50-54 years", "30-34 years", "60-64 years", "35-39 years", "15-19 years", 
"45-49 years", "50-54 years", "15-19 years", "20-24 years", "40-44 years", 
"35-39 years", "15-19 years", "60-64 years", "35-39 years", "15-19 years", 
"55-59 years", "50-54 years", "40-44 years", "55-59 years", "40-44 years", 
"35-39 years", "30-34 years", "25-29 years", "25-29 years", "25-29 years", 
"60-64 years", "55-59 years", "20-24 years", "20-24 years", "45-49 years", 
"25-29 years", "60-64 years", "20-24 years", "50-54 years", "50-54 years", 
"30-34 years", "20-24 years", "45-49 years", "45-49 years", "30-34 years", 
"55-59 years", "50-54 years", "30-34 years", "50-54 years", "45-49 years", 
"15-19 years", "35-39 years", "35-39 years", "15-19 years", "60-64 years", 
"55-59 years", "35-39 years", "15-19 years"), cause_id = c(381L, 
384L, 384L, 383L, 384L, 384L, 384L, 382L, 383L, 384L, 383L, 383L, 
383L, 382L, 383L, 383L, 382L, 382L, 382L, 383L, 382L, 382L, 382L, 
381L, 382L, 382L, 381L, 384L, 381L, 384L, 381L, 381L, 381L, 381L, 
384L, 381L, 384L, 383L, 381L, 383L, 383L, 384L, 384L, 384L, 382L, 
381L, 384L, 384L, 382L, 383L, 381L, 384L, 383L, 383L, 381L, 381L, 
383L, 383L, 382L, 382L, 384L, 383L, 382L, 382L, 381L, 383L, 382L, 
382L, 381L, 381L, 383L, 382L, 381L, 381L, 384L, 383L, 381L, 384L, 
384L, 382L, 384L, 383L, 382L, 381L, 384L, 383L, 383L, 381L, 381L, 
384L, 382L, 382L, 384L, 381L, 382L, 381L, 384L, 384L, 383L, 382L
), val = c(517643.7663, 12196.2975, 14225.67971, 52744.01396, 
18443.32637, 24208.75606, 28241.3328, 20184.94793, 10432.74561, 
37858.30335, 14459.09591, 20051.46927, 23216.13517, 52319.93429, 
32731.61697, 45408.44109, 61918.50533, 66131.93925, 15987.54032, 
69391.1515, 38376.46027, 25222.33745, 28766.86089, 294902.9795, 
58160.39925, 46646.87495, 408714.1343, 9114.22776, 133558.4582, 
43173.61263, 167155.0367, 98109.78749, 68237.79501, 458635.3345, 
6636.090986, 226494.1951, 33085.19121, 61845.2722, 344196.9799, 
76000.61862, 55606.89027, 28922.34364, 14361.10352, 9258.788575, 
28787.02575, 134412.5027, 19471.24864, 12385.35678, 53422.59703, 
10772.28762, 300277.5492, 43792.41213, 24307.05639, 20732.71456, 
513879.4883, 460119.2101, 35935.51574, 48488.39815, 66925.74778, 
16061.51119, 24883.86913, 79555.09305, 20248.06365, 25418.77045, 
236183.0999, 14991.54505, 40534.9835, 47846.11284, 347974.6517, 
414342.1249, 66039.34548, 59356.11218, 69134.72655, 98877.6251, 
38655.66525, 73207.47988, 168741.2049, 33926.36979, 6808.740946, 
63501.33848, 12477.07123, 21348.56217, 54847.10913, 462120.2148, 
14820.16332, 26238.13449, 59250.88449, 100298.2209, 135156.3855, 
29707.42893, 25549.67494, 30245.42434, 44509.59545, 305959.0932, 
49100.43474, 513020.8818, 6912.081399, 9500.157171, 51828.50618, 
68083.65449), upper = c(667038.4965, 15203.17904, 17827.31688, 
106393.8318, 23153.88656, 30178.75256, 35144.1548, 39546.99686, 
20792.87191, 47157.04937, 27861.74097, 40823.83298, 47592.52357, 
112011.5088, 65775.83207, 91081.13051, 141875.4496, 150534.3994, 
30957.85661, 147040.1384, 77164.48695, 50004.90283, 57410.00459, 
373109.4618, 129590.1365, 98207.5963, 519153.2244, 11316.02392, 
167994.7278, 54393.52969, 208491.3753, 123230.6959, 85306.47304, 
588003.801, 8279.669129, 284483.062, 41277.80808, 130136.6436, 
436583.7994, 163772.0124, 112405.1452, 36089.03081, 17972.68246, 
11508.49788, 57114.7265, 168054.6087, 24293.22151, 15472.55997, 
114649.1679, 21357.80316, 375801.5164, 54737.14298, 50547.03988, 
41930.10207, 660008.5114, 583406.1739, 71640.87215, 96972.82131, 
152883.0518, 31280.05088, 30939.88734, 171536.0869, 39695.5075, 
50662.10217, 294509.1785, 29132.12707, 81509.47713, 101537.7466, 
437340.8984, 525090.4511, 138947.9271, 132118.3248, 86550.23571, 
123281.871, 48538.03239, 155855.5468, 209328.4331, 42383.85434, 
8560.817876, 144862.6824, 15532.75586, 43975.89533, 117175.5667, 
583777.5106, 18510.2172, 54825.5805, 120140.9561, 125434.1487, 
168029.7245, 37190.1905, 50797.00506, 60194.85318, 55620.45539, 
381959.8971, 103967.7065, 648737.495, 8651.146756, 11896.67938, 
104459.3714, 156798.1685), lower = c(392819.4842, 9302.462385, 
10843.48694, 21212.97278, 14048.73085, 18437.52787, 21380.54026, 
9377.402251, 4190.176687, 28693.91223, 6348.634103, 8758.678839, 
9915.065708, 21745.75372, 13783.67499, 18543.02787, 23717.17238, 
25283.94823, 7369.040332, 26958.39714, 17144.39021, 11460.11641, 
13210.20649, 227014.2072, 23220.13212, 19635.46759, 314352.2939, 
6926.386829, 104637.0863, 32888.82827, 130173.1674, 76508.51358, 
53338.11256, 348706.5984, 5052.930325, 174534.6017, 25081.42798, 
24573.10097, 264933.8038, 28769.94335, 22431.63681, 21966.91062, 
11005.56578, 6999.065839, 13156.66896, 105330.3724, 14808.92885, 
9425.17536, 21962.92031, 4262.360537, 232915.3823, 33262.63753, 
10262.92615, 8986.652561, 393180.0428, 352606.3394, 14783.95456, 
19896.96184, 25556.51164, 7356.165904, 18870.45159, 29475.61234, 
9440.461939, 11765.83384, 184037.7058, 6497.014403, 17911.64999, 
20148.0206, 269279.1989, 319737.056, 26094.00696, 23732.60239, 
54232.06398, 77040.11254, 29349.29153, 28223.53487, 131882.1785, 
25657.49138, 5229.962472, 24459.10606, 9562.774561, 9285.658063, 
22741.19343, 356076.5915, 11421.33997, 10952.66478, 23824.5497, 
78617.65146, 106288.4025, 22424.39073, 11969.37114, 14120.83026, 
34050.1977, 238134.7127, 20776.75994, 396178.4133, 5264.754377, 
7301.91916, 20899.70201, 25919.45827), iso2c = c("1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", 
"1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W", "1W"), 
    country = c("World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World", "World", "World", "World", 
    "World", "World", "World", "World"), `GDP per capita (constant 2015 US$)` = c(6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6794.01055864621, 
    6794.01055864621, 6794.01055864621, 6794.01055864621, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6780.12257434847, 
    6780.12257434847, 6780.12257434847, 6780.12257434847, 6813.30863999674, 
    6813.30863999674, 6813.30863999674, 6813.30863999674, 6813.30863999674, 
    6813.30863999674, 6813.30863999674, 6813.30863999674, 6813.30863999674, 
    6813.30863999674, 6813.30863999674, 6813.30863999674, 6813.30863999674, 
    6813.30863999674, 6813.30863999674, 6813.30863999674, 6813.30863999674, 
    6813.30863999674, 6813.30863999674, 6813.30863999674), us = c(3516.87721385959, 
    82.8617739913904, 96.6494181536592, 358.343387749623, 125.304154094338, 
    164.47454428333, 191.871913233442, 137.136749362144, 70.8801838300099, 
    257.209712692331, 98.2352502810182, 136.22989393675, 157.730667475938, 
    355.462185993936, 222.378951295743, 308.505428217124, 420.674978987612, 
    449.30109352825, 108.619517740862, 471.444215967619, 260.730076277847, 
    171.360826949038, 195.442356625767, 2003.57395649923, 395.142366599579, 
    316.919360938149, 2776.80814390214, 61.9221596353464, 907.397575207308, 
    293.321980063121, 1135.65308427069, 666.558932113596, 463.608299796676, 
    3115.97330516124, 45.0856722270209, 1538.80395298147, 224.781138415569, 
    420.177432329149, 2338.47791569474, 516.349005367924, 377.021532008945, 
    196.097035016628, 97.3700421685073, 62.7757214284772, 195.179563135926, 
    911.333243830945, 132.017452454816, 83.9742370954379, 362.211756103424, 
    73.0374304697365, 2035.91858990095, 296.917922067785, 164.8048217458, 
    140.570346015779, 3484.16591911747, 3119.6646432904, 243.647201489629, 
    328.757282890812, 453.76477332833, 108.89901459747, 168.715682825446, 
    539.393282292698, 137.28435344021, 172.342379340227, 1601.35036731159, 
    101.644513017867, 274.832156679193, 324.402509761308, 2359.31079129222, 
    2809.290394538, 447.754857084146, 402.441716117178, 468.741920153064, 
    670.402418038475, 262.090148587983, 496.355686945549, 1144.08605256525, 
    230.024945678873, 46.1640981908654, 430.546858529591, 85.0101372132137, 
    145.454343084369, 373.690282514273, 3148.56765221399, 100.974346794319, 
    178.768508418113, 403.694563223166, 683.362735034272, 920.86216907788, 
    202.405882200858, 174.07782101781, 206.07141097609, 303.257611242245, 
    2084.59373318513, 334.536416241638, 3495.36960646669, 47.0941439161675, 
    64.7275029345013, 353.123608954318, 463.87495137927), us_upper = c(4531.86658824449, 
    103.290558922749, 121.118979115052, 722.840816624029, 157.307749762337, 
    205.034763539411, 238.769758785897, 268.682714229588, 141.266991301118, 
    320.385491334381, 189.292962332446, 277.357552310529, 323.344107647199, 
    761.007373477093, 446.88169758732, 618.806162378373, 963.903302595078, 
    1022.73229896307, 210.328004681395, 998.9922528344, 524.256339090818, 
    339.733837811098, 390.044177356387, 2534.909623, 880.436755677403, 
    667.223446201464, 3527.13248812883, 76.8811859943731, 1141.3579544701, 
    369.550215035896, 1416.49260517487, 837.23064909392, 579.573078554628, 
    3994.9040325181, 56.2521594845231, 1932.780926984, 280.441863933292, 
    884.149730685179, 2966.15494285748, 1112.66878145634, 762.120662443438, 
    244.688052481238, 121.856990068643, 78.0290262730295, 387.244846470389, 
    1139.43084617017, 164.711019563599, 104.905853135557, 777.335411409058, 
    144.808523343607, 2547.98034481803, 371.124538774038, 342.71512615688, 
    284.291231589543, 4474.93860740527, 3955.56536967366, 485.733894510228, 
    657.487614862191, 1036.56583074447, 212.082579098257, 209.776228601732, 
    1163.03569510609, 269.140406500969, 343.495262586766, 1996.80832950067, 
    197.519392386095, 552.644245912453, 688.438367871135, 2965.22489792768, 
    3560.17762107793, 942.083977189636, 895.778436461583, 586.821206952552, 
    835.866196575016, 329.093809121896, 1056.7197111961, 1419.2724347143, 
    287.367727598531, 58.0433945359535, 982.186743120913, 105.829459703898, 
    299.621347603481, 798.353300993624, 3977.45635680677, 126.115822776976, 
    373.543601313487, 818.557414213599, 854.621569088346, 1144.83837371212, 
    253.388246256775, 346.095673461256, 410.126113254629, 378.95932926924, 
    2602.4106670437, 708.364072977095, 4420.04877977334, 58.9429329385346, 
    81.055748407025, 711.713937688248, 1068.31431617671), us_lower = c(2668.81972329676, 
    63.2010276650992, 73.6707647629023, 144.121161047595, 95.4472257304787, 
    125.264759024114, 145.259616276, 63.7101699059667, 28.4681046540712, 
    194.946742659488, 43.1326871287634, 59.5065565119571, 67.363061109823, 
    147.7408803794, 93.6464334190077, 125.981527138051, 161.134719570952, 
    171.779411238884, 50.0653378226978, 183.155634813338, 116.479168108291, 
    77.8601518928547, 89.7502823749567, 1542.3369206795, 157.75782279644, 
    133.403574130415, 2135.71280389126, 47.057945249494, 710.905469148175, 
    223.447046527882, 884.397873768021, 519.799649088847, 362.3796999109, 
    2369.1163113992, 34.3296619801536, 1185.78992679891, 170.403486522044, 
    166.949907448859, 1799.9630603595, 195.463298891553, 152.089247115067, 
    148.938346583357, 74.619084988455, 47.4545242943551, 89.2038282189258, 
    714.152835673771, 100.406352797805, 63.903844225529, 148.911291792448, 
    28.8993268969258, 1579.19484144523, 225.524759599524, 69.5838972684862, 
    60.9306058966626, 2665.80888397158, 2390.71420162432, 100.237024050398, 
    134.903840132334, 173.276281491963, 49.8757065063629, 127.943974813509, 
    199.848264619178, 64.0074891048914, 79.7737956246172, 1247.79820362588, 
    44.0505540196474, 121.443182441028, 136.606049298498, 1825.74597526436, 
    2167.85643124132, 176.920565644702, 160.909953212475, 367.700041244309, 
    522.341406162801, 198.991794043687, 191.359025899998, 894.177335602105, 
    173.960936506689, 35.4597866194025, 165.835737145789, 65.1541345388023, 
    63.2660543086933, 154.942769680456, 2426.05971736754, 77.8171142979411, 
    74.623885576562, 162.324010315042, 535.64632394867, 724.175691084701, 
    152.784295107372, 81.5510198034896, 96.2095748143854, 231.994506183007, 
    1622.48529552205, 141.55847801034, 2699.28580631709, 35.8703964842747, 
    49.7502289013857, 142.39612027809, 176.597268975026)), row.names = c(NA, 
100L), class = "data.frame")

image

**I'm not sure can this type of data be showed by waffle bar chart?** Because when I write the first row coding ```{r} global_2c <-global_w_cause %>% dplyr::count(year,cause_id) ``` and my data frame will be showed like this

image

because the number of cause_id in every year is equal.I'm so curious about that this situation can use waffle?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant