How to draw horizontal line in my yaxis using my existing code
Show older comments
Hi there,
So I've got this code at the moment, which opens a file (using my really smaller scale data) then filters all the NaN values and removes duplications.
Now I have drawn a scatter plot (bottom of my code). I was hoping to see a horizontal line across y axis. I have set a minimum and maximum threshold 'y1Thresh' so that once my data has been plotted, I can see how much data is out of bounds (low or high threshold). So if anyone can please help me how to use my existing code to show a horizontal line on Y-axis, that would be greatly appreciated. Please Help!! :(
%--FIND NaN ROWS THEN DELETE ENTIRE ROW
PCBAllDataSet = readtable('testfile5.csv');
%imports the only columns needed
PCBRequiredCol = PCBAllDataSet(:,{'PcbTestID','TestTime','PcbID','Verify12VInput','VerifyCurrentDraw','Rail5V'});
%remove row that contains NaN value
PCBRemoveNaNRow = rmmissing(PCBRequiredCol);
%--REMOVE ROW DUPLICATIONS'y1
%create another table for keyset and valueset
%duplications will be removed as the table is made
newTable = containers.Map('KeyType','char','ValueType','any');
%forloop to assign key and value set on every row
for i = 1:size(PCBRemoveNaNRow,1)
%key for hashMap to partner with valueSet
keyID = char(table2cell(PCBRemoveNaNRow(i,3)));
%current(i) row, 2nd column to end column
valueSet = PCBRemoveNaNRow(i,2:end);
%setting value pairs
newTable(keyID) = valueSet;
end
%shows the
voltsInput = newTable.values;
allDataSet = [];
for j = 1:numel(voltsInput)
allDataSet = [allDataSet; voltsInput{j}];
end
%--Verify12VInput vs. Date/Time, Scatter Plot
figure;
x1 = allDataSet{:,1}; %date and time
y1 = allDataSet.Verify12VInput; %gets all column values of Verify12VInput
%--HEEELLPPP HEREEE
%--sets the min and max THRESHOLD so I can see how data in the graph
% is out of bounce(out of the line)
%--hoping to see a (min,max) horizontal line from y axis
y1Thresh = [11.75, 12.25];
scatterPlot = scatter(x1,y1);
1 Comment
Andrea Del Rosario
on 16 Jan 2019
Accepted Answer
More Answers (1)
Steven Lord
on 31 Jan 2019
0 votes
Categories
Find more on Scatter 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!