functionvarargout =plot_fig(varargin)% PLOT_FIG MATLAB code for plot_fig.fig
% PLOT_FIG, by itself, creates a new PLOT_FIG or raises the existing
% singleton*.
%
% H = PLOT_FIG returns the handle to a new PLOT_FIG or the handle to
% the existing singleton*.
%
% PLOT_FIG('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PLOT_FIG.M with the given input arguments.
%
% PLOT_FIG('Property','Value',...) creates a new PLOT_FIG or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before plot_fig_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to plot_fig_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help plot_fig
% Last Modified by GUIDE v2.5 27-Apr-2018 13:56:23
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @plot_fig_OpeningFcn, ...
'gui_OutputFcn', @plot_fig_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before plot_fig is made visible.
functionplot_fig_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to plot_fig (see VARARGIN)
% Choose default command line output for plot_fig
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes plot_fig wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
functionvarargout =plot_fig_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
functionpushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data1_s = get(handles.popupmenu1,'value');
data1_e = get(handles.popupmenu2,'value');
data2_s = get(handles.popupmenu3,'value');
data2_e = get(handles.popupmenu4,'value');
data3_s = get(handles.popupmenu5,'value');
data3_e = get(handles.popupmenu6,'value');
data4_s = get(handles.popupmenu7,'value');
data4_e = get(handles.popupmenu8,'value');
data5_s = get(handles.popupmenu9,'value');
data5_e = get(handles.popupmenu10,'value');
load('data_years.mat');
% 这个数据就是每年不同洲之间的数据结果,
% 要修改这个数据点开数据后为5行35列的数据
% 其中行从上往下代表
% Asia
% Europe
% America
% Africa
% Oceania
% 而第几行第几列的数据要这么看,
% 第一行第1~5的数据代表起点为Asia,终点分别为
% 在2007年第一个时间点的数据
% 起点删除了非洲,数据仍然不变,只需要不填就可以了
% 第一行第6~10的数据代表起点为Asia,终点分别为
% Asia Europe America Africa Oceania
% 在2008年第一个时间点的数据
% 后面的以此类推
trace1 = zeros(2100,1);
trace2 = zeros(2100,1);
trace3 = zeros(2100,1);
trace4 = zeros(2100,1);
trace5 = zeros(2100,1);
word = [' America '
' Asia '
' Europe '
' Oceania '
' Africa '
];
name_trace1 = [word(data1_s,:) 'to' word(data1_e,:)];
name_trace2 = [word(data2_s,:) 'to' word(data2_e,:)];
name_trace3 = [word(data3_s,:) 'to' word(data3_e,:)];
name_trace4 = [word(data4_s,:) 'to' word(data4_e,:)];
name_trace5 = [word(data5_s,:) 'to' word(data5_e,:)];
for i = 1:1:10
trace1(i+2006) = data_years(data1_s,data1_e+(i-1)*5);
trace2(i+2006) = data_years(data2_s,data2_e+(i-1)*5);
trace3(i+2006) = data_years(data3_s,data3_e+(i-1)*5);
trace4(i+2006) = data_years(data4_s,data4_e+(i-1)*5);
trace5(i+2006) = data_years(data5_s,data5_e+(i-1)*5);
end
axes(handles.axes1);
cla reset;
% axis(h1,[2005,2015,2,5]);
plot(trace1,'color','r','Marker','o');
hold on;
plot(trace2,'color','b','Marker','+');
hold on;
plot(trace3,'color','k','Marker','*');
hold on;
plot(trace4,'color','g','Marker','square');
hold on;
plot(trace5,'color','c','Marker','x');
legend(name_trace1,name_trace2,name_trace3,name_trace4,name_trace5);
xlabel('date/year');
ylabel('average AS path length/hops');
set(handles.axes1,'XLim',[2007,2016],'YLim',[0,7]);
% --- Executes on selection change in popupmenu1.
functionpopupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
functionpopupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu2.
functionpopupmenu2_Callback(hObject, eventdata, handles)% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
% --- Executes during object creation, after setting all properties.
functionpopupmenu2_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu3.
functionpopupmenu3_Callback(hObject, eventdata, handles)% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu3
% --- Executes during object creation, after setting all properties.
functionpopupmenu3_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu4.
functionpopupmenu4_Callback(hObject, eventdata, handles)% hObject handle to popupmenu4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu4
% --- Executes during object creation, after setting all properties.
functionpopupmenu4_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu5.
functionpopupmenu5_Callback(hObject, eventdata, handles)% hObject handle to popupmenu5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu5
% --- Executes during object creation, after setting all properties.
functionpopupmenu5_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu6.
functionpopupmenu6_Callback(hObject, eventdata, handles)% hObject handle to popupmenu6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu6 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu6
% --- Executes during object creation, after setting all properties.
functionpopupmenu6_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu7.
functionpopupmenu7_Callback(hObject, eventdata, handles)% hObject handle to popupmenu7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu7 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu7
% --- Executes during object creation, after setting all properties.
functionpopupmenu7_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu8.
functionpopupmenu8_Callback(hObject, eventdata, handles)% hObject handle to popupmenu8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu8 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu8
% --- Executes during object creation, after setting all properties.
functionpopupmenu8_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu9.
functionpopupmenu9_Callback(hObject, eventdata, handles)% hObject handle to popupmenu9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu9 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu9
% --- Executes during object creation, after setting all properties.
functionpopupmenu9_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu10.
functionpopupmenu10_Callback(hObject, eventdata, handles)% hObject handle to popupmenu10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu10 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu10
% --- Executes during object creation, after setting all properties.
functionpopupmenu10_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton2.
functionpushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data=[2007200820092010201120122013201420152016
485663688294118136147162
53606165707179848891
7989109126131140153157165175
13141515192227303336
193219248274302327377407433464
]';
plot(handles.axes2,data(:,1),data(:,2:end-1),'--*')
legend(' America','Asia-Pacific','Europe','Africa')