how to show P-values in correlation map?

25 views (last 30 days)
Hello,
I have generated two maps by using corrcoef function, one is correlation map and second one is pvalue map. Now, I want to highlight (with dots) those pixels in correlation map which is having pvalue value less than 0.05. I have tried with stipples function but it is show some error. Is there any other way?
Thanks

Accepted Answer

Hassaan
Hassaan on 13 Feb 2024
% Example data for demonstration
% Replace these with your actual corrMap and pValueMap variables
corrMap = rand(100); % 100x100 matrix of correlation values
pValueMap = rand(100); % 100x100 matrix of p-values
% Display the correlation map
imagesc(corrMap);
colormap('jet'); % Use a colormap of your choice
colorbar;
title('Correlation Map with Significant P-values Highlighted');
xlabel('X-axis Label');
ylabel('Y-axis Label');
% Hold on to overlay the dots
hold on;
% Get the indices where p-value is less than 0.05
[rows, cols] = find(pValueMap < 0.05);
% Overlay dots at these positions
% 'wo' stands for white circle, change the color/marker as needed
plot(cols, rows, 'wo', 'MarkerSize', 4);
% Hold off if you're done plotting
hold off;
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  2 Comments
Vedanta
Vedanta on 13 Feb 2024
wow this works like charm, thanks @Hassaan
Hassaan
Hassaan on 13 Feb 2024
@Vedanta You are welcome.
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!