Hello! I want to make a plot like this, but I don't know exactly how.
More specifically,I want to plot the possible values of flux variability for some reactions.
Could someone guide me? Thank you.

3 comentarios

Star Strider
Star Strider el 16 de Dic. de 2021
Look through the SimBiology documentation to see if it has a function that can produce that sort of plot. (I don’t have it, so I’m unfamiliar with its functions.)
.
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
Thank you, I'll look for it.
Star Strider
Star Strider el 16 de Dic. de 2021
My pleasure!

Iniciar sesión para comentar.

 Respuesta aceptada

John D'Errico
John D'Errico el 16 de Dic. de 2021
Editada: John D'Errico el 16 de Dic. de 2021

0 votos

Easier than you think.
First, write a little function that will plot a bar of fixed height, between two points on the x axis. It might look like the function called xbar below.
Next, call that function repeatedly, once for each horizontal bar.
Finally, change the y axis to have a different set of tick labels. It looks like you will need to set the YTickLabel property on the axes. For example:
plot(rand(1,5))
H = get(gca);
H.YTickLabel
ans = 9×1 cell array
{'0' } {'0.1'} {'0.2'} {'0.3'} {'0.4'} {'0.5'} {'0.6'} {'0.7'} {'0.8'}
Now you can reset those tick mark lables as desired. And they need not be numbers.
function xbar(y,xlo,xhi,barcolor)
% On the current figure, creates a horizontal bar
% of unit height, between y and y+1, and between xlo and xhi
% this can be as simple as one call to fill.
barpolyx = [xlo,xhi,xhi,xlo];
barpolyy = [y,y,y+1,y+1];
fill(barpolyx,barpolyy,barcolor)
end
Should be pretty simple. Spend some time learning to use the basic tools.

4 comentarios

Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
Thank you, I' ll try this.
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
For every y-value, I have 2500 possible x-values because I used sampling. Therefore, I want all the possible x-values to be imprinted on the diagram. Αt first sight, Ι don't know xlo and xhi for every y-value.
John D'Errico
John D'Errico el 16 de Dic. de 2021
Wait. You were the one who implied you knew that.
I have no idea what it means to have ALL of the values shown. But surely you might be able to choose two percentiles of your data. Perhaps the 5 and 95% points from the data, thus excluding a few outliers. Or the 1% and 99% points. Or just the max and the min. Your choice.
help prctile
help min
help max
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
Yes, thank you!!

Iniciar sesión para comentar.

Más respuestas (1)

Arthur Goldsipe
Arthur Goldsipe el 16 de Dic. de 2021

1 voto

This looks to me like a horizontally oriented box plot. You can easily create such plots using boxchart or boxplot. Since you want a legend, I recommend using boxchart.

8 comentarios

Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
thank you very much
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
I can't use boxchart, because sais
Undefined function or variable 'boxchart'.
Why?
Arthur Goldsipe
Arthur Goldsipe el 16 de Dic. de 2021
What version of MATLAB are you using? boxchart was introduced in R2020a, so if you're using an older version of MATLAB it won't be available. boxplot is a much older function, but it requires Statistics and Machine Learning Toolbox, so I don't know if you will have access to it either.
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
My version is 2019. So, how can I have access to Statistics and Machine Learning Toolbox? Should I download it or what?
Arthur Goldsipe
Arthur Goldsipe el 16 de Dic. de 2021
You can see which toolboxes you already have by running ver. If you don't see Statistics and Machine Learning, one way to add that (if you're licensed for it) is to use the Add-On Manager. You can read more about that here.
I don't have a lot of experience with licensing and installation. If you have further questions about installation issues, I suggest you post a separate question for those issues so that someone who is better able to help is more likely to see your question.
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
I have installed this toolbox, but there is no boxchart
Arthur Goldsipe
Arthur Goldsipe el 16 de Dic. de 2021
The function from the Stats toolbox is named boxplot (not boxchart).
Ioannis Vourvachakis
Ioannis Vourvachakis el 16 de Dic. de 2021
Yes, there is boxplot! Thank you!

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by