How to plot the value from multiple rows over one row using different tables?

3 vues (au cours des 30 derniers jours)
I'm trying to get the growth (represented in each week W1) of a genotype ploted over the salt accumilation in the soil for the matching group.
Table 1 = PG
Table 2 = acumilation
I'm trying to get the output to be similar to this graph with the salt acumilation being the x axis and the plant growth being the y axis. and the variables being the genotype.
Since there are two different unique salt accumilation methods. I believe making two graphs would be best, one showing the 200mM accumilation and the other showing the 400mM accumilation.
This is the current code I have
for i = PG.Groups('200mM-NaCl-1')
for j = PlantGrowth.Genotype in i
avgrowth = PlantGrowth(PlantGrowth(:,W1))
I'm currently unsure how to get the growth values for each genotype in the 200mM-NaCl-1 group and plot them over the weekly salt accumilation values for the respective group.
I have attached both tables
  1 commentaire
Peter Perkins
Peter Perkins le 5 Juin 2023
MartinLuther, this is likely not hard to do, you need to be much more clear. Your tables seem to have little to do with your example figure:
  • I see NO values in the 400-600 range in those tables, yet that's what I see in the figure
  • The legend shows what I guess are genotypes, NONE of those are in your data
  • The W1 etc. seem to be some sort of time series, but who knows?
  • etc.
You need to show exactly how the example data you have provided are turned into a figure.

Connectez-vous pour commenter.

Réponse acceptée

Divyanshu
Divyanshu le 17 Mai 2023
Hi Martinluther,
As per the description provided you want to plot the growth for a group ‘200mM NaCl-1’ for each ‘Genotype against salt accumulation across all the weeks.
Based on this understanding I have plotted the same for two ‘Genotypes’ “WT-2” & “35N8-1-2”. For the same, here is the a sample script you can refer to:
load("acumilation.mat");
load("PG.mat");
groups = PG.Groups;
y1 = PG((groups == "200mM NaCl-1" & PG.Genotype == "WT-2"),:);
y2 = PG((groups == "200mM NaCl-1" & PG.Genotype == "35N8-1-2"),:);
growth1 = y1{1,3:7};
growth2 = y2{1,3:7};
x = acumilation((acumilation.Groups == "200mM NaCl-1"),:);
accum = x{1,2:6};
plot(growth1,accum,growth2,accum);
legend(PG.Genotype{:,1},'Location','southwest');
In the above script the "growth1" holds the data for 1st genotype and "growth2" holds the data for 2nd genotype. And ‘accum’ holds the salt accumulation over weeks. "y1" & "y2" are cell arrays.
Please refer to the following documentation for further details on how to access elements from a cell array:

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by