Clear Filters
Clear Filters

Add Trendline to gplotmatrix

3 views (last 30 days)
MustangManiac
MustangManiac on 2 Aug 2018
Edited: MustangManiac on 2 Aug 2018
How can I add basic trendlines to a gplotmatrix? I compile a large amount of data ending up in a 10x10 scatter plot matrix and I'd like each of those to have a trendline.
if true
Data_Excel = paste; %Using Copy/Paste tool put
Data=Data_Excel(2:end,1:end); %input data from excel in data array
legend=Data_Excel(1,1:end); %take header files for legend
figure
% Changed to use 'cell2float' function, this allows you to put NAN or blank
% spaces in your data set. Useful if you have outlier data points you don't
% have to hide the whole data set, just delete the specific outlier data
% variable
[h,ax,BigAx]=gplotmatrix(cell2float(Data),[],cell2float(Data(:,1)),distinguishable_colors(25),'xxxxxxx',4, ...
'on','variable',regexprep(legend,'_',' '),regexprep(legend,'_',' ')'); %Plot a series of scatter plots, plots will be generated based on number of Excel columun headers were used
end

Answers (0)

Categories

Find more on Line Plots 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!