フィルターのクリア

Create a 4D graphic with the function plotmatrix

1 回表示 (過去 30 日間)
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 10 日
コメント済み: Alejandro Fernández 2020 年 11 月 17 日
Hello, I have the following information that has by columns the components X,Y,Z and the information to represent in the fourth column:
data = [26.2500000000000,10,20,0.000432113572874648;32.5000000000000,10,30,0.000113660965880058;38.7500000000000,10,30,0.00144840712375238;38.7500000000000,10,40,2.82213642366358e-06;45,10,30,0.00671528961126988;45,10,40,0.000460445802102694;45,20,30,0.000352579008291443];
What I want to achieve is to be able to represent it similarly to what is shown in the documentation of matlab but so that each component always has the same color and different from the rest, ie the position X = 26.25 with value = 0.0004 has for example blue and that Y = 10 with value = 0.0004 is also blue as well as Z = 20 and value 0.0004 exactly the same, but when representing the value of the second row go to another different color
I someone knows how to do it with another function is algo nice for me! Thank you so much :D

採用された回答

Amanpreetsingh Arora
Amanpreetsingh Arora 2020 年 11 月 17 日
Unfortunately, "plotmatrix" does not support this "scatter" like functionality as it uses "plot" and "histogram" internally to generate plots. I work with MathWorks Technical Support and I have forwarded an enhancement request for this functionality to the developers.
As a workaround, you can modify "plotmatrix" for your workflow. You can open "plotmatrix" using the following command.
edit plotmatrix
Copy the contents of this file to a new M file in your working directory and let's call it "plotmatrix_custom". Line 153 of this function calls "plot" which generates off diagonal plots in the final figure. Modify this line to call "scatter" as follows.
hh(i,j,:) = scatter(reshape(x(:,j,:),[m k]), ...
reshape(y(:,i,:),[m k]),markersize*ones(m,1),1:m,'filled','parent',ax(i,j))';
This will generate plots with the desired functionality. Note that the fourth argument (1:m) provides individual colors to each datapoint. Also, comment out line 155 in order to avoid error as scatter plots do not have 'markersize' property. For more information on "scatter", refer to the following documentation.
Then use the custom function "plotmatrix_custom" instead of "plotmatrix" to generate the desired plots.
  1 件のコメント
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 17 日
Ok, thamk you so much for you help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by