Plot matrix containing negatives in confusionchart() style
21 ビュー (過去 30 日間)
古いコメントを表示
Christopher McCausland
2023 年 7 月 26 日
編集済み: Christopher McCausland
2023 年 8 月 4 日
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 件のコメント
採用された回答
Shubham
2023 年 7 月 26 日
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:
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Orange についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!