MATLAB Answers

How to draw 2 different plot on a graph

2 views (last 30 days)
Hung Tat Ho
Hung Tat Ho on 29 May 2020
Commented: Hung Tat Ho on 29 May 2020
we have two column A and B. so how to draw 2 different plots on a graph?

  0 Comments

Sign in to comment.

Answers (1)

Tommy
Tommy on 29 May 2020
Edited: Tommy on 29 May 2020
hold on
or
set(gca, 'NextPlot', 'add')
in between your calls to plot or however you are plotting.

  5 Comments

Show 2 older comments
Hung Tat Ho
Hung Tat Ho on 29 May 2020
Thank Tommy, here is my code, can you help me! newdata is about 1 column and 1.300.000 rows
[clearData,outlierIndices]=rmoutliers(Databbase);
Newdata=table2array(clearData)
A=Newdata(:,1);
plot(A,'m-')
Tommy
Tommy on 29 May 2020
Ok thank you. What are you hoping the plot will look like? Your vector is so long that it is impossible to see any of the background which would make it easier to see the actual values being plotted. Similar to the following:
plot(rand(1000000,1))
Do you no longer have two columns to plot?
Hung Tat Ho
Hung Tat Ho on 29 May 2020
Hi. i have two columns with too much raws as each column and i want the plot look like as below, it included two different plots in one graph.

Sign in to comment.

Tags

Products


Release

R2018b

Translated by