Error while using plotyy function

1 view (last 30 days)
Hello: I am using plotyy function with indexing:
X = B_SLR(:,1); Y = B_SLR(:,2); Y1 = B_HighQ(:,4);
kdx = B_SLR(:,4) < 0.10; mdx = B_HighQ(:,4) < 0.10;
plotyy(X(kdx),Y(kdx),'bo-','lineWidth',2,'MarkerEdgeColor','b','MarkerFaceColor','b',X(kdx),Y1(mdx),'ro-','lineWidth',2,'MarkerEdgeColor','r','MarkerFaceColor','r'); hold on;
plotyy(X(kdx),Y(~kdx),'bo-','lineWidth',2,X(kdx),Y1(~mdx),'ro-'); hold on;
in which X,Y and Y1 are 10x4 matrices. I am imposing certain criteria for indexing, such as, if a particular value in column 4 in matrices Y and Y1 are less than 0.10 the markerfacecolor will be filled and if not then it will be unfilled with any color. However, while using plotyy function I am encountering foll. error:
plotyy error Argument must contain a character vector or function handle.
I am unaware of any other ways to plot secondary Y-axes other than plotyy. Any help in this regard?
  1 Comment
the cyclist
the cyclist on 16 May 2018
Can you upload a MAT file with the variables, so that we can try your code ourselves?

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 16 May 2018
Edited: the cyclist on 16 May 2018
Read the documentation for plotyy a bit more carefully. The first four arguments are supposed to be vectors with data.
If you have version R2016a or later, the preferred way to do this is with yyaxis.

More Answers (0)

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!