Question
I am fitting a random (regression) forest and creating partial dependence plots. In order to make the plots easier to visualize, I remove observations whose predictor (X-variable) takes values in the extreme tails (lower than first percentile and larger than 99th percentile). When I create the partial dependence plots, the x-axis has equally spaced ticks. That is, even if 95% of the x-values are between zero and 5 while only 5% are between 6 and 10, I still have an x-axis with ticks at 1,2,3,4,5,6,7,8,9,10. I want something where the ticks occur at the 10th,20th,30th,40th,50th,60th,70th,80th,90th, 100th percentiles. Is this possible? below is the code I'm using for the plots: % train model Forest_fit = TreeBagger(NumTrees,X,Y,'Method','regression','OOBPredictorImportance','on','CategoricalPredictors',cat_X_vec) ; x_ax = prctile(X(:,1),1:99); % exclued top and bottom 1 percent for scale purpose ax = plotPartialDependence(Forest_fit,1,X,'QueryPoints',x_ax');
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 12, 2026
This is not tested but to get the percentiles you listed,
x_ax = prctile(X(:,1),10:10:100)
and use those percentiles as x-ticks,
set(ax, 'XTick', x_ax)
If this solution isn't want you're asking for, please attach some data.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related partial dependence... Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →