|
| 1 | +classdef PlotCorrelationCircles < imagem.actions.CurrentTableAction |
| 2 | +% Pair-wise scatter plot of table columns. |
| 3 | +% |
| 4 | +% Class PlotCorrelationCircles |
| 5 | +% |
| 6 | +% Example |
| 7 | +% PlotCorrelationCircles |
| 8 | +% |
| 9 | +% See also |
| 10 | +% |
| 11 | + |
| 12 | +% ------ |
| 13 | +% Author: David Legland |
| 14 | + |
| 15 | +% Created: 2020-12-23, using Matlab 9.8.0.1323502 (R2020a) |
| 16 | +% Copyright 2020 INRAE - BIA-BIBS. |
| 17 | + |
| 18 | + |
| 19 | +%% Properties |
| 20 | +properties |
| 21 | +end % end properties |
| 22 | + |
| 23 | + |
| 24 | +%% Constructor |
| 25 | +methods |
| 26 | + function obj = PlotCorrelationCircles(varargin) |
| 27 | + % Constructor for PlotCorrelationCircles class. |
| 28 | + |
| 29 | + end |
| 30 | + |
| 31 | +end % end constructors |
| 32 | + |
| 33 | + |
| 34 | +%% Methods |
| 35 | +methods |
| 36 | + function run(obj, frame) %#ok<INUSL> |
| 37 | + |
| 38 | + table = frame.Doc.Table; |
| 39 | + |
| 40 | + % identify numeric columns |
| 41 | + inds = ~isFactor(table, 1:size(table, 2)); |
| 42 | + colNames = table.ColNames(inds); |
| 43 | + |
| 44 | + % Open a dialog for choosing the columns to display |
| 45 | + [numColInds, ok] = listdlg(... |
| 46 | + 'ListString', colNames, ... |
| 47 | + 'Name', 'Correlation Circles', ... |
| 48 | + 'PromptString', 'Columns To Plot:', ... |
| 49 | + 'ListSize', frame.Gui.Options.DlgListSize, ... |
| 50 | + 'SelectionMode', 'Multiple'); |
| 51 | + |
| 52 | + if ~ok || isempty(numColInds) |
| 53 | + return; |
| 54 | + end |
| 55 | + |
| 56 | + % create Plot Pair display |
| 57 | + createPlotFrame(frame.Gui); |
| 58 | + correlationCircles(table(:, numColInds)); |
| 59 | + |
| 60 | + % create pattern for writing history |
| 61 | + numColNames = table.ColNames(numColInds); |
| 62 | + nc = length(numColNames); |
| 63 | + pattern = ['{''%s''' repmat(', ''%s''', 1, nc-1) '}']; |
| 64 | + numColsString = sprintf(pattern, numColNames{:}); |
| 65 | + |
| 66 | + % add to history |
| 67 | + string = sprintf('figure; correlationCircles(%s(%s));\n', ... |
| 68 | + frame.Doc.Tag, numColsString); |
| 69 | + addToHistory(frame, string); |
| 70 | + |
| 71 | + end |
| 72 | +end % end methods |
| 73 | + |
| 74 | +end % end classdef |
| 75 | + |
0 commit comments