How to change the properties of a plot obtained from compare(mdl,data) function.
6 ビュー (過去 30 日間)
古いコメントを表示
I use "compare(mdl,data)" function. This function plots the test component degradation data in data superimposed on the most similar data sets from the historical ensemble stored in the fitted similarity model. However, the qualiy of the fiqure is not good enough. For instance, I want to double the linewidth or change the color of the lines. could you please me help me how can I do it?
Many thanks
0 件のコメント
採用された回答
Star Strider
2021 年 12 月 28 日
I don’t have the Predictive Maintenance Toolbox so I have no direct experience with it. However it exists with the online Run feature, so I gave some effort to getting the information necessary to address the problems mentioned. It took a bit of handle spelunking, however was not as difficult as some other plot types in other MATLAB Toolboxes.
I include an example at the end on how to set the red line to have a LineWidth of 5 —
D1 = load('pairwiseTrainTables.mat');
pairwiseTrainTables = D1.pairwiseTrainTables;
D2 = load('pairwiseTestData.mat');
pairwiseTestData = D2.pairwiseTestData;
mdl = pairwiseSimilarityModel;
fit(mdl,pairwiseTrainTables,"Time","Condition")
figure
compare(mdl,pairwiseTestData) % Original
figure
compare(mdl,pairwiseTestData) % Test
Ax = gca;
% GetAx = get(Ax)
Kids = Ax.Children
Sctr = findobj(Kids, 'Type','Scatter')
Grp = Kids([2 3])
Line = findobj(Kids, 'Type','Line')
Line1 = Line(1)
Line2 = Line(2)
Line3 = Line(3)
Line2.LineWidth = 5; % Define Red Line To Have Width = 5
Explore and customise to produce the desired result!
.
2 件のコメント
Star Strider
2021 年 12 月 29 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
その他の回答 (1 件)
Tanmay Das
2021 年 12 月 28 日
Hi,
You can add formatting to your plots by adding name-value pair arguments to "compare" function. For instance, to double the linewidth or change the color of the line, to say red, you may write the following line in your code:
compare(mdl,data,'r','LineWidth',10)
2 件のコメント
Tanmay Das
2021 年 12 月 28 日
編集済み: Tanmay Das
2021 年 12 月 28 日
Can you please share your reproduction steps(all the code that is required to reproduce the issue at my end) for further investigation?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!