필터 지우기
필터 지우기

Plot with two x-axes with additional input arguments

조회 수: 3 (최근 30일)
Andreas Volden
Andreas Volden 2014년 12월 16일
댓글: Andreas Volden 2014년 12월 19일
Hi! I'm trying to plot two functions using the same y-axis. Even though the x-axes differ, the function in both are the same. The difference is that one is taken for each sample, and the other only for valid samples, which in this case is 10% of all samples. Code is below:
t1 = [1:length(q_mean_norm)];
t2 = [1:length(A3)];
figure(6)
[ax,hl1,hl2] = plotxx_abv(t1,q_mean_norm,'r',t2,q_mean_norm(A3),'o',xlabels,ylabels);
set(ax,'ylim',[-100 2000]);
grid;
I want the valid samples to have an 'o' marking on the curve for all samples. This means that I want the markings 'o' placed along the curve of q_mean_norm by using A3 as input for location of those markings.
By using the plotxx function I've encountered a problem. It doesn't handle all my inputs(6 is max against my 8). In addition, the function internally uses "line" for creating the variables hl1 and hl2 and "line" does not like string inputs. Changing this only leads to another problem about reading-only jibberish.
So, you guys have som suggestion to solve my problem? I may have tried to solve this in a difficult way, but I haven't managed to get any further using other methods..
Thanks!

채택된 답변

dpb
dpb 2014년 12월 16일
Just do what you want directly if plotxx isn't flexible-enough interface...
function [ax,hl1,hl2] = plotxx(x1,y1,x2,y2,xlabels,ylabels);
doesn't have provision to set linestyles but you saved the handles in your call...
[ax,hL1,hL2]=plotxx(t1,q_mean_norm,t2,q_mean_norm(A3),xlabels,ylabels);
set(hL2,'marker','o','markerfacecolor','r','markeredgecolor','r')
See topic 'Lineseries Properties' under the 'Line Plots' subject in the Graphics chapter for details on what properties are named, values, etc., ...
Or, just type
set(hL1)
at the command line to observe...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by