Plot matrix containing negatives in confusionchart() style
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christopher McCausland
am 26 Jul. 2023
Bearbeitet: Christopher McCausland
am 4 Aug. 2023
Hello,
I have a matrix of numbers which includes negitives. I would like to plot this in the same graphical style as confusionchart() so all figures look consistent. I have had a look inside the function with open confusionchart() however I do not beleive the specific code is visable.
Is there an easy way to replicate this? If not I can code it manually, however I don't want to spend lots of time on this if there is a pre-existing solotion.
Kind regards,
Christopher
0 Kommentare
Akzeptierte Antwort
Shubham
am 26 Jul. 2023
Hi Christopher,
If you want to plot a matrix of numbers with negative values in the same graphical style as `confusionchart()`, you can use the `imagesc()` function in MATLAB. `imagesc()` is commonly used to visualize matrices as images, with a color scale representing the values.
Here's an example of how you can use `imagesc()` to plot a matrix with negative values:
% Example matrix with negative values
matrix = [1 2 3; -1 -2 -3; 4 5 6];
% Plot the matrix using imagesc()
figure;
imagesc(matrix);
% Set the color map to match confusionchart()
colormap(parula); % You can choose a different colormap if desired
% Add colorbar for reference
colorbar;
In this example, `imagesc()` is used to plot the `matrix` with negative values. The `colormap()` function is then used to set the color map to match the style of `confusionchart()`. You can choose a different colormap if you prefer.
By using `imagesc()` and setting the appropriate colormap, you can achieve a consistent graphical style similar to `confusionchart()` for plotting matrices with negative values.
You can refer to these documentation for more info:
4 Kommentare
Christopher McCausland
am 4 Aug. 2023
Bearbeitet: Christopher McCausland
am 4 Aug. 2023
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Orange finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!