Is there anyway to interactively change the color of a data point in an imagesc plot?

4 views (last 30 days)
Say I had an imagesc plot and wanted to change one of the values from black to white. Is there anyway to do that in the plot itself, or is there any way to maybe use a GUI to allow the user to do that?
Here is the code for reference
nRows = 20;
nCols = 50;
Matrix = zeros(nRows,nCols);
Rndm = randi([0 1],size(Matrix));
imagesc(Rndm)
colormap(gca, gray)
  4 Comments
Walter Roberson
Walter Roberson on 25 Jan 2020
Well, you could do it with techniques such as first converting your image to rgb using mat2gray() followed by im2uint8() followed by ind2rgb() . After that, you could use ginput() or similar to designate points you wanted to change the color of, and some kind of interface indicating the color you wanted to change to, and store the results in a matrix .
Alex Weaver
Alex Weaver on 25 Jan 2020
I don’t have access to a computer at the moment but I will try that tomorrow, thank you!

Sign in to comment.

Answers (1)

Alex Weaver
Alex Weaver on 28 Jan 2020
That did the trick, thank you for the help!

Categories

Find more on Color and Styling 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!