scatter plot with color dependent on variable

4 visualizaciones (últimos 30 días)
Dilay Durmaz
Dilay Durmaz el 12 de Jun. de 2022
Comentada: dpb el 12 de Jun. de 2022
I want to show all my data like this. In summary;
1. I want to show my data from each group in a different color
2. I want to create error bars like this.
3. I want to set the x and y axes from 1 to 5.
But I don't know how to do it. I'm just learning Matlab.
My codes is below;
scatter (UkWaterS,WaterBeS);
hold on
scatter (UkAG30S,AG30BeS);
hold on
scatter (UkAG40S,AG40BeS);
hold on
scatter (UkAG50S,AG50BeS);
hold on
scatter (UkAG60S,AG60BeS);
hold on
scatter (UkAG70S,AG70BeS);
% Add a colorbar
ColorVariable = 'UkWaterS','UkAG30S', 'UkAG40S','UkAG50S','UkAG60S','UkAG70S';
colorbar
w = c.LineWidth;
c.LineWidth = 1;
  1 comentario
dpb
dpb el 12 de Jun. de 2022
  1. Simply set the color for each in the initial call
2. That will take defining a line for each boundary and plotting those areas with patch
3. xlim([1 5]); ylim([1 5])
There are many examples in graphics in the doc section; explore those. Unfortunately, some graphics packages these days have left MATLAB HG2 far behind in the prepackaged appearance of some of these features like the shaded error bands. Not sure how the image you posted was created, but while it can be done in MATLAB, it's "roll your own" to do so; such a stylistic enhancement is not a prepackaged feature.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by