Hi,

I am using Stata 17 and need help in bar charts. Below is an example of my dataset:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input int date float(open high low close) double volume float change
14977 1320.28 1320.28 1276.05 1283.27 11294          .
14978 1283.27 1347.76 1274.62 1347.56 18807   64.29004
14979 1347.56 1350.24 1329.14 1333.34 21310 -14.220093
14980 1333.34 1334.77 1294.95 1298.35 14308  -34.98999
14983 1298.35 1298.35 1276.29 1295.86 11155   -2.48999
14984 1295.86 1311.72 1295.14  1300.8 11913   4.940063
14985  1300.8 1313.76 1287.28 1313.27 12965   12.46997
14986 1313.27 1332.19 1309.72 1326.82 14112  13.549927
14987 1326.82 1333.21 1311.59 1318.55 12760  -8.269897
14991 1318.32 1327.81 1313.33 1326.65 12057   8.099976
14992 1326.65 1346.92 1325.41 1329.47 13491   2.819946
14993 1329.89 1352.71 1327.41 1347.97 14450       18.5
14994 1347.97 1354.55 1336.74 1342.54 14078  -5.429932
14997 1342.54 1353.62 1333.84  1342.9 11640  .35998535
14998  1342.9  1362.9 1339.63  1360.4 12326       17.5
14999  1360.4 1369.75 1357.28  1364.3 13090  3.9000244
15000  1364.3 1367.35 1354.63 1357.51 12580  -6.790039
15001 1357.51 1357.51 1342.75 1354.95 10980 -2.5600586
15004 1354.92 1365.54 1350.36 1364.17 10531   9.220093
15005 1364.17 1375.68  1356.2 1373.73 11498   9.559937
15006 1373.73 1383.37 1364.66 1366.01 12953  -7.719971
15007 1366.01  1373.5 1359.34 1373.47 11188   7.459961
15008 1373.47 1376.38 1348.72 1349.47 10484        -24
15011 1349.47 1354.56 1344.48 1354.31 10130   4.840088
15012 1354.31 1363.55 1350.04 1352.26 10596 -2.0500488
15013 1352.26 1352.26 1334.26 1340.89 11583 -11.369995
15014  1341.1 1350.32 1332.42 1332.53 11072  -8.359985
15015 1332.53 1332.53 1309.98 1314.76 10755  -17.77002
15018 1314.76 1330.96 1313.64 1330.31 10391   15.55005
15019 1330.31 1336.62 1317.51  1318.8 10752  -11.51001
15020  1318.8 1320.73 1304.72 1315.92 11503  -2.880005
15021 1315.92 1331.29 1315.92 1326.61 11537   10.68994
15022 1326.61 1326.61 1293.18 1301.53 12572 -25.079956
15026 1301.53 1307.16 1278.44 1278.94 11122  -22.59009
15027 1278.94 1282.97 1253.16 1255.27 12085  -23.66992
15028 1255.27 1259.94 1228.33 1252.82 13659  -2.450073
15029 1252.82 1252.82 1215.44 1245.86 12313  -6.959961
15032 1245.86 1267.69 1241.71 1267.65 11308   21.79004
15033 1267.65 1272.76 1252.26 1257.94 11141  -9.710083
15034 1257.94 1263.47 1229.65 1239.94 12253        -18
15035 1239.94 1241.36  1214.5 1241.23 12949   1.290039
15036 1241.23 1251.01 1219.74 1234.18 12940  -7.049927
15039 1234.18 1242.55 1234.04 1241.41  9292    7.22998
15040 1241.41 1267.42 1241.41  1253.8 10918  12.390015
15041  1253.8 1263.86  1253.8 1261.89 11322   8.089966
15042 1261.89  1266.5  1257.6 1264.74 11141  2.8499756
15043 1264.74 1264.74 1228.42 1233.42 10859 -31.319946
15046 1233.42 1233.42 1176.78 1180.16 12290  -53.26001
15047 1180.16 1197.83  1171.5 1197.66 13609       17.5
15048 1197.66 1197.66 1155.35 1166.71 13974 -30.950073
end
format %td date
I have run this command to create the bar chart:
Code:
twoway bar change date in 1/20
The bar chart looks like this:

Array



As you can see, there is no spacing between the bars, I would like them to look like this:

Array

This example is done in excel and as you can see, the excel version has spacing between the different bars.

What I also need is to exclude the days that have no observations at all. So for example, there is no 7th Jan at all and therefore I don't want a large spacing between the bar graph of 6th Jan and 8th Jan. In other ways, I do not want Stata to include dates in between the dates if those dates eg 7th Jan has no data at all.

Is there a way to do such modifications to the bar charts? Thanks!