{"id":230,"date":"2015-04-28T15:25:03","date_gmt":"2015-04-28T19:25:03","guid":{"rendered":"https:\/\/blogs.mathworks.com\/graphics\/?p=230"},"modified":"2022-06-15T10:41:48","modified_gmt":"2022-06-15T14:41:48","slug":"state_taxes","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/graphics\/2015\/04\/28\/state_taxes\/","title":{"rendered":"State Taxes"},"content":{"rendered":"<div class=\"content\"><p>If you live in the US, you probably filed your taxes sometime in the last couple of months. If you're like me, that got you looking at data about taxes. One nice source of tax data is the <a href=\"http:\/\/www.census.gov\/\">US Census Bureau<\/a>.<\/p><p>Justice Louis Brandeis called the states the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Laboratories_of_democracy\">laboratories of democracy<\/a>. They're also the laboratories of tax policy. If we go to <a title=\"http:\/\/factfinder.census.gov\/bkmk\/table\/1.0\/en\/STC\/2014\/STC005\">this page of the census bureau's site<\/a>, we can get a lot of details about how different types of taxes contribute to the various states' revenues.<\/p><p>The first step is to hit the download button on that page. That will give us  two files named 'STC_2014_STC005_with_ann.csv' and 'STC_2014_STC005_metadata.csv'. The first contains all of the tax data. The second contains the names of the different types of taxes.<\/p><p>MATLAB's <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/readtable.html\">readtable<\/a> command sucks that in pretty easily, although it warns about things like spaces and quotes in the names of the taxes.<\/p><pre class=\"codeinput\">t = readtable(<span class=\"string\">'STC_2014_STC005_with_ann.csv'<\/span>,<span class=\"string\">'Delimiter'<\/span>,<span class=\"string\">','<\/span>,<span class=\"string\">'HeaderLines'<\/span>,1);\r\nm = readtable(<span class=\"string\">'STC_2014_STC005_metadata.csv'<\/span>);\r\n<\/pre><pre class=\"codeoutput\">Warning: Variable names were modified to make them valid MATLAB identifiers. \r\nWarning: Variable names were modified to make them valid MATLAB identifiers. \r\n<\/pre><p>There are a couple of different types of information in the data file.<\/p><p>The 3rd column contains the names of the states.<\/p><pre class=\"codeinput\">state_names = table2array(t(2:end,3));\r\nstate_names(1:5)\r\n<\/pre><pre class=\"codeoutput\">\r\nans = \r\n\r\n    'Alabama'\r\n    'Alaska'\r\n    'Arizona'\r\n    'Arkansas'\r\n    'California'\r\n\r\n<\/pre><p>The 4th column contains the total amount each state took in for 2014.<\/p><pre class=\"codeinput\">state_totals = table2array(t(2:end,4));\r\nstate_totals(1:5)\r\n<\/pre><pre class=\"codeoutput\">\r\nans =\r\n\r\n     9293754\r\n     3392869\r\n    13084043\r\n     8936781\r\n   138069870\r\n\r\n<\/pre><p>And the rest of the table contains the revenues for each type of tax for each state.<\/p><pre class=\"codeinput\">raw_tax_receipts = table2array(t(2:end,5:end));\r\nraw_tax_receipts(1:5,1:5)\r\n<\/pre><pre class=\"codeoutput\">\r\nans =\r\n\r\n      329598     4812674     2393192     2419482      181427\r\n      128076      257696           0      257696       39078\r\n      823508     7759625     5994048     1765577       71136\r\n     1077377     4324157     3130274     1193883       51618\r\n     2176236    50002053    37224077    12777976      354297\r\n\r\n<\/pre><p>And we'll need the tax names which are in the 2nd column of the metadata starting at row 4.<\/p><pre class=\"codeinput\">raw_tax_names = m.Id(4:end);\r\n<\/pre><p>But the different types of taxes aren't a flat list. Some of them are \"roll-ups\" of the others. For example, the tax named \"Income Taxes\" (column 23) is the sum of the two taxes named \"Individual Income Taxes\" and \"Corporation Net Income Taxes\" (columns 24 and 25). This means that we need to break them into two sets. First we'll look at the top level groups.<\/p><pre class=\"codeinput\">top_level = [1 2 13 23 26];\r\ntax_receipts = raw_tax_receipts(:,top_level);\r\ntax_names = raw_tax_names(top_level);\r\n<\/pre><p>Next we need to decide how we're going to visualize this data. One challenge is that the total tax revenues of the various states vary pretty widely. California took in 138 million dollars, but South Dakota only took in 1.6 million dollars. To compare them, it will help to normalize our data.<\/p><p>This is actually a good job for something called a \"stacked percentage column chart\". MATLAB doesn't have one built in, because it isn't actually useful for a lot of things we do, but it is pretty easy to create one with the bar command. All we need to do is multiply the various tax revenues of the different states by 100 divided by the total tax revenues for that state. We'll also want the names of the states along the X axis. The result is a function that looks something like this:<\/p><pre class=\"language-matlab\"><span class=\"keyword\">function<\/span> h = normbar(data,totals,rownames)\r\n  scale = 100.\/repmat(totals,[1 size(data,2)]);\r\n  h = bar(data.*scale,<span class=\"string\">'stacked'<\/span>,<span class=\"string\">'BarWidth'<\/span>,1);\r\n  ax = gca;\r\n  ax.Position=[.05 .235 .93 .72];\r\n  axis(ax,<span class=\"string\">'tight'<\/span>)\r\n  ax.XTick = 1:50;\r\n  ax.XTickLabel = rownames;\r\n  ax.XTickLabelRotation = 90;\r\n<\/pre><pre class=\"codeinput\">h = normbar(tax_receipts, state_totals, state_names);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_01.png\" alt=\"\"> <p>But that's really hard to understand without a legend. One problem with stacked bar charts is that they stack from the bottom up, but the legend goes from the top down. To fix that, we'll need to use fliplr.<\/p><pre class=\"codeinput\"><span class=\"keyword\">for<\/span> i=1:length(h)\r\n    h(i).DisplayName = tax_names{i};\r\n<span class=\"keyword\">end<\/span>\r\nlegend(fliplr(h),<span class=\"string\">'Location'<\/span>,<span class=\"string\">'northoutside'<\/span>)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_02.png\" alt=\"\"> <p>That helps a little bit. We can now start to see some differences between the states. For example, we can see that Vermont depends a lot on property taxes.<\/p><p>But it's hard to compare the different states when they're in alphabetical order. It'd be better to rank them by a particular type of tax revenue. For example, if we sort them by property tax, we'll get Vermont on the right, along with other states which are dependent on property taxes.<\/p><pre class=\"codeinput\">tax_index = 1;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_03.png\" alt=\"\"> <p>But if we sort by income taxes, we'll get Oregon on the right and the states with no income taxes on the left.<\/p><pre class=\"codeinput\">tax_index = 4;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_04.png\" alt=\"\"> <p>The category labeled \"Other Taxes\" looks kind of interesting, but it's kind of hard to guess what it means from the name. It's made up of a collection of unrelated taxes.<\/p><pre class=\"codeinput\">tax_index = 5;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_05.png\" alt=\"\"> <p>To see what's going on here, we need to drill down to those subcategories that I mentioned earlier.<\/p><pre class=\"codeinput\">other_taxes = 27:30;\r\nother_tax_receipts = raw_tax_receipts(:,other_taxes);\r\nother_totals = raw_tax_receipts(:,26);\r\nother_tax_names = raw_tax_names(other_taxes);\r\n\r\nh = normbar(other_tax_receipts, other_totals, state_names);\r\n\r\n<span class=\"keyword\">for<\/span> i=1:length(h)\r\n    h(i).DisplayName = other_tax_names{i};\r\n<span class=\"keyword\">end<\/span>\r\nlegend(fliplr(h),<span class=\"string\">'Location'<\/span>,<span class=\"string\">'northoutside'<\/span>);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_06.png\" alt=\"\"> <p>We see three important taxes hiding in this group. First is called \"death and gift taxes\" which are apparently important in Indiana.<\/p><pre class=\"codeinput\">tax_index = 1;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, other_tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_07.png\" alt=\"\"> <p>Next is \"documentary and stock transfer taxes\" which are apparently important in Georgia, New Hampshire, and South Carolina.<\/p><pre class=\"codeinput\">tax_index = 2;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, other_tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_08.png\" alt=\"\"> <p>And finally, there's something called a \"severance tax\". Can you guess what this is from the names of the states which depend a lot on it?<\/p><pre class=\"codeinput\">tax_index = 3;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle([<span class=\"string\">'States ranked by \"'<\/span>, other_tax_names{tax_index}, <span class=\"string\">'\"'<\/span>])\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_09.png\" alt=\"\"> <p>That's right, a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Severance_tax\">severance tax<\/a> is the money that a company pays to the state when it extracts a non-renewable resource such as oil, coal, or natural gas.<\/p><p>But those last three charts were normalized to the size of the \"Other Taxes\" category. That's actually a small factor for most of these states, so let's go back and normalize against the state totals again.<\/p><pre class=\"codeinput\">[~,idx] = sort(other_tax_receipts(:,tax_index).\/state_totals);\r\nh = normbar(other_tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\n\r\n<span class=\"keyword\">for<\/span> i=1:length(h)\r\n    h(i).DisplayName = other_tax_names{i};\r\n<span class=\"keyword\">end<\/span>\r\nlegend(fliplr(h),<span class=\"string\">'Location'<\/span>,<span class=\"string\">'northoutside'<\/span>);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/graphics\/2015\/state_taxes_10.png\" alt=\"\"> <p>Now we can see that the states which show up with large revenues from \"Other\" are the ones that depend a lot on these severance taxes. They're the states which take in a lot of payments for the extraction of natural resources, such as <a href=\"http:\/\/www.aoga.org\/facts-and-figures\/state-revenue\">Alaska's famous oil and gas revenues<\/a>.<\/p><p>What interesting patterns can you find in this dataset? Can you use some of these techniques for other types of data?<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_41bc157331a040f5a481695a8eb5133a() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='41bc157331a040f5a481695a8eb5133a ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 41bc157331a040f5a481695a8eb5133a';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2015 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_41bc157331a040f5a481695a8eb5133a()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2015a<br><\/p><\/div><!--\r\n41bc157331a040f5a481695a8eb5133a ##### SOURCE BEGIN #####\r\n%% State Taxes\r\n% If you live in the US, you probably filed your taxes sometime in the last \r\n% couple of months. If you're like me, that got you looking at data about \r\n% taxes. One nice source of tax data is the <http:\/\/www.census.gov\/ US Census Bureau>. \r\n%\r\n% Justice Louis Brandeis called the states the\r\n% <http:\/\/en.wikipedia.org\/wiki\/Laboratories_of_democracy laboratories of\r\n% democracy>. They're also the laboratories of tax policy. If we go to\r\n% <http:\/\/factfinder.census.gov\/bkmk\/table\/1.0\/en\/STC\/2014\/STC005\r\n% this page of the census bureau's site>, we can get a lot of details about\r\n% how different types of taxes contribute to the various states'\r\n% revenues.\r\n%\r\n% The first step is to hit the download button on that page. That will give\r\n% us  two files named 'STC_2014_STC005_with_ann.csv' and\r\n% 'STC_2014_STC005_metadata.csv'. The first contains all of the tax data.\r\n% The second contains the names of the different types of taxes.\r\n%\r\n% MATLAB's <https:\/\/www.mathworks.com\/help\/matlab\/ref\/readtable.html readtable>\r\n% command sucks that in pretty easily, although it warns about things\r\n% like spaces and quotes in the names of the taxes.\r\nt = readtable('STC_2014_STC005_with_ann.csv','Delimiter',',','HeaderLines',1);\r\nm = readtable('STC_2014_STC005_metadata.csv');\r\n\r\n%%\r\n% There are a couple of different types of information in the data file.\r\n%\r\n% The 3rd column contains the names of the states.\r\n%\r\nstate_names = table2array(t(2:end,3));\r\nstate_names(1:5)\r\n\r\n%%\r\n% The 4th column contains the total amount each state took in for 2014.\r\n%\r\nstate_totals = table2array(t(2:end,4));\r\nstate_totals(1:5)\r\n\r\n%%\r\n% And the rest of the table contains the revenues for each type of tax for\r\n% each state.\r\n%\r\nraw_tax_receipts = table2array(t(2:end,5:end));\r\nraw_tax_receipts(1:5,1:5)\r\n\r\n%%\r\n% And we'll need the tax names which are in the 2nd column of the metadata\r\n% starting at row 4.\r\nraw_tax_names = m.Id(4:end);\r\n\r\n%%\r\n% But the different types of taxes aren't a flat list. Some of them are\r\n% \"roll-ups\" of the others. For example, the tax named \"Income Taxes\" (column 23) is\r\n% the sum of the two taxes named \"Individual Income Taxes\" and \"Corporation\r\n% Net Income Taxes\" (columns 24 and 25). This means that we need to break them into two sets.\r\n% First we'll look at the top level groups.\r\n%\r\ntop_level = [1 2 13 23 26];\r\ntax_receipts = raw_tax_receipts(:,top_level);\r\ntax_names = raw_tax_names(top_level);\r\n\r\n%%\r\n% Next we need to decide how we're going to visualize this data. One\r\n% challenge is that the total tax revenues of the various states vary\r\n% pretty widely. California took in 138 million dollars, but South Dakota\r\n% only took in 1.6 million dollars. To compare them, it will help to\r\n% normalize our data. \r\n%\r\n% This is actually a good job for something called a \"stacked percentage\r\n% column chart\". MATLAB doesn't have one built in, because it isn't actually\r\n% useful for a lot of things we do, but it is pretty easy to create one\r\n% with the bar command. All we need to do is multiply the various tax revenues of\r\n% the different states by 100 divided by the total tax revenues for that\r\n% state. We'll also want the names of the states along the X axis. The \r\n% result is a function that looks something like this:\r\n%\r\n%   function h = normbar(data,totals,rownames)\r\n%     scale = 100.\/repmat(totals,[1 size(data,2)]);\r\n%     h = bar(data.*scale,'stacked','BarWidth',1);\r\n%     ax = gca;\r\n%     ax.Position=[.05 .235 .93 .72];\r\n%     axis(ax,'tight')\r\n%     ax.XTick = 1:50;\r\n%     ax.XTickLabel = rownames;\r\n%     ax.XTickLabelRotation = 90;\r\n%\r\nh = normbar(tax_receipts, state_totals, state_names);\r\n\r\n%%\r\n% But that's really hard to understand without a legend. One problem with\r\n% stacked bar charts is that they stack from the bottom up, but the legend\r\n% goes from the top down. To fix that, we'll need to use fliplr.\r\n%\r\nfor i=1:length(h)\r\n    h(i).DisplayName = tax_names{i};\r\nend\r\nlegend(fliplr(h),'Location','northoutside')\r\n\r\n%%\r\n% That helps a little bit. We can now start to see some differences between\r\n% the states. For example, we can see that Vermont depends a lot on\r\n% property taxes. \r\n%\r\n% But it's hard to compare the different states when they're in\r\n% alphabetical order. It'd be better to rank them by a particular type of tax revenue. \r\n% For example, if we sort them by property tax, we'll get Vermont on the\r\n% right, along with other states which are dependent on property taxes.\r\ntax_index = 1;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', tax_names{tax_index}, '\"'])\r\n\r\n%%\r\n% But if we sort by income taxes, we'll get Oregon on the right and the\r\n% states with no income taxes on the left.\r\ntax_index = 4;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', tax_names{tax_index}, '\"'])\r\n\r\n\r\n%%\r\n% The category labeled \"Other Taxes\" looks kind of interesting, but it's\r\n% kind of hard to guess what it means from the name. It's made up of a \r\n% collection of unrelated taxes.\r\n%\r\ntax_index = 5;\r\n[~,idx] = sort(tax_receipts(:,tax_index).\/state_totals);\r\nnormbar(tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', tax_names{tax_index}, '\"'])\r\n\r\n%%\r\n% To see what's going on here, we need to drill down to those\r\n% subcategories that I mentioned earlier.\r\nother_taxes = 27:30;\r\nother_tax_receipts = raw_tax_receipts(:,other_taxes);\r\nother_totals = raw_tax_receipts(:,26);\r\nother_tax_names = raw_tax_names(other_taxes);\r\n\r\nh = normbar(other_tax_receipts, other_totals, state_names);\r\n\r\nfor i=1:length(h)\r\n    h(i).DisplayName = other_tax_names{i};\r\nend\r\nlegend(fliplr(h),'Location','northoutside');\r\n\r\n%%\r\n% We see three important taxes hiding in this group. First is called \"death and\r\n% gift taxes\" which are apparently important in Indiana.\r\n% \r\ntax_index = 1;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', other_tax_names{tax_index}, '\"'])\r\n\r\n%%\r\n% Next is \"documentary and stock transfer taxes\" which are apparently\r\n% important in Georgia, New Hampshire, and South Carolina.\r\ntax_index = 2;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', other_tax_names{tax_index}, '\"'])\r\n\r\n%%\r\n% And finally, there's something called a \"severance tax\". Can you guess\r\n% what this is from the names of the states which depend a lot on it?\r\ntax_index = 3;\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/other_totals);\r\nnormbar(other_tax_receipts(idx,:), other_totals(idx), state_names(idx));\r\ntitle(['States ranked by \"', other_tax_names{tax_index}, '\"'])\r\n\r\n%%\r\n% That's right, a <http:\/\/en.wikipedia.org\/wiki\/Severance_tax severance\r\n% tax> is the money that a company pays to the state when it extracts a\r\n% non-renewable resource such as oil, coal, or natural gas.\r\n%\r\n% But those last three charts were normalized to the size of the \"Other\r\n% Taxes\" category. That's actually a small factor for most of these states,\r\n% so let's go back and normalize against the state totals again.\r\n%\r\n[~,idx] = sort(other_tax_receipts(:,tax_index).\/state_totals);\r\nh = normbar(other_tax_receipts(idx,:), state_totals(idx), state_names(idx));\r\n\r\nfor i=1:length(h)\r\n    h(i).DisplayName = other_tax_names{i};\r\nend\r\nlegend(fliplr(h),'Location','northoutside');\r\n\r\n%%\r\n% Now we can see that the states which show up with large revenues from\r\n% \"Other\" are the ones that depend a lot on these severance taxes. They're \r\n% the states which take in a lot of payments for the extraction of natural \r\n% resources, such as <http:\/\/www.aoga.org\/facts-and-figures\/state-revenue Alaska's famous oil and gas revenues>.\r\n%\r\n% What interesting patterns can you find in this dataset? Can you use some\r\n% of these techniques for other types of data?\r\n##### SOURCE END ##### 41bc157331a040f5a481695a8eb5133a\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/feature_image\/statetaxesthumbnail.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>If you live in the US, you probably filed your taxes sometime in the last couple of months. If you're like me, that got you looking at data about taxes. One nice source of tax data is the US Census... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/graphics\/2015\/04\/28\/state_taxes\/\">read more >><\/a><\/p>","protected":false},"author":89,"featured_media":231,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/230"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/users\/89"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"predecessor-version":[{"id":1889,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/230\/revisions\/1889"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/media\/231"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}