Clear Filters
Clear Filters

How to change y axis units from decimal to % in probability plots (function: probplot) or Weibull plots (function: wblplot)?

10 views (last 30 days)
When drawing probability plots using "probplot" or "wblplot", how do you get the y axis to be displayed in % instead of decimals? Thanks!

Answers (1)

Gautam
Gautam on 17 Sep 2024 at 10:53
To display the y axis labels as percentages for “probplot” or “wbplot, you can modify the y-axis tick labels using MATLAB's axis manipulation functions.
Specifically, you can use the functions yticks and yticklabels functions to change the y-axis labels from decimals to percentages.
The code below changes the y-axis labels to percentages to get the corresponding output
data = randn(1000, 1); % Generate random data
probplot('normal', data); % Create a normal probability plot
yt = yticks; % Get the current y-axis ticks
yticklabels(arrayfun(@(y) sprintf('%.0f%%', y * 100), yt, 'UniformOutput', false)); % Convert y-axis tick labels from decimals to percentages
% Add labels and title
xlabel('Data');
ylabel('Probability (%)');
You can refer to the following documents for more information on the axis functions

Community Treasure Hunt

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

Start Hunting!