Clear Filters
Clear Filters

Filtering out sections of a graph

2 views (last 30 days)
Chirag Chavda
Chirag Chavda on 19 Apr 2019
Edited: Chirag Chavda on 19 Apr 2019
The title may not be as descriptive as it should - I aplologise: still getting used to MATLAB
I am wondering if you could help me?
At the moment, I am using data obtained from the Department of Transport (RDL0103) and plotting it as stacked bar graphs.
The code I have so far is shown below (only contains inputs):
clearvars
clc
load CodingData.mat
a=Year;
data_set = (2017:1:2037);
b1=Trunk_Motorways; % Major Motorways, [miles]
b2=Principle_Motorways; % Minor Motorways, [miles]
b3=Total_Motorways; % Total Amount of Miles Constructed on both types of motorways, [miles]
x11 = interp1(a, b1, data_set, 'linear', 'extrap')
x12 = interp1(a, b2, data_set, 'linear', 'extrap')
x13 = interp1(a, b3, data_set, 'linear', 'extrap')
c1=Trunk_A_Roads;
c2=Principle_A_Roads;
c3=Total_A_Roads;
a21 = interp1(a, c1, data_set, 'linear', 'extrap')
a22 = interp1(a, c2, data_set, 'linear', 'extrap')
a23 = interp1(a, c3, data_set, 'linear', 'extrap')
d1=B_Roads;
d2=C_Roads;
d3=U_Roads;
d4=C_And_U_Roads;
x31 = interp1(a, d1, data_set, 'linear', 'extrap')
x32 = interp1(a, d2, data_set, 'linear', 'extrap')
x33 = interp1(a, d3, data_set, 'linear', 'extrap')
x34 = interp1(a, d4, data_set, 'linear', 'extrap')
e1=All_Major_Roads;
e2=All_Minor_Roads;
x41 = interp1(a, e1, data_set, 'linear', 'extrap')
x42 = interp1(a, e2, data_set, 'linear', 'extrap')
% Stacked Graph
y=[b1 b2 b3];
bar(a,y,'stacked')
9k=
This is the results I get. My question is this:
Is it possible for me to show only certain catergories on the figure without me having to change the code (or make multiple versions of the same code)? [e.g. Showing only Trunk_Motorways and Total_Motorways but not Principle_Motorways]

Answers (0)

Categories

Find more on Graphics Object Identification in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!