Lasso Plot Datatip Shows only X and Y
6 views (last 30 days)
Show older comments
hi community I am trying to figure out how I can modify the lasso plot so that the datatip shows the name of the selected coefficient with a fitted value, the L1 norm of a set of coefficients including the selected coefficient, and the index of the corresponding Lambda. I am basically following the example included in the documentation Trace plot of lasso fit - MATLAB lassoPlot (mathworks.com), however my lassoplot only shows x and y instead of the helpful information I need. I am using Matlab Online version, and I have tried didfferent data to
Here is a screen of how mine datatip only shows X and Y value:

0 Comments
Answers (1)
Aditya
on 20 Oct 2023
Hi Skrowh,
I followed the documentation and have simulated the example you mentioned. However, I was unable to reproduce the error you referred to. In order to assist you better, kindly share the complete code that is producing this error.
Below is the code that I have simulated. Please run this code and let me know if you get any error with this code.
load acetylene
X = [x1 x2 x3];
D = x2fx(X,'interaction');
D(:,1) = []; % No constant term
B = lasso(D,y);
lassoPlot(B,'PredictorNames',{'x1','x2','x3','x1.*x2','x1.*x3','x2.*x3'});
legend('show','Location','NorthWest') % Show legend
Hope this helps!
0 Comments
See Also
Categories
Find more on Annotations 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!