How to replicate a graph from some data collected using webplot digitiser

3 visualizaciones (últimos 30 días)
I have two .csv files I made from webplot digitiser and I want to replicate this graph
the csv files are called 'Strength_Mpa' and 'Grainsize_nm' repectively.
The data is in tabular for as follows
Strength_Mpa Grainsize_nm
20 2880 25 90
20 3280 1200 120
20 3990 1300 150
1200 2000 1350 310
1200 2990 1400 450
1200 3500 1500 790
1300 2200
1300 2700
1300 3280
1400 1390
1400 1770
1400 2150
I have been using this with no success
x = [20,1200,1300,1400]'
y = [3280,2990,2700,1770]'
err = [((3990-2880)/2),((3500-2000)/2),((3280-2200)/2),((2150-1390)/2)]
errorbar(x,y,err)
Which does not output as gracefull of a graph as I am looking for.
Please help me figure out how to properly use the error bar function and fit a curve to the graph alongside haveing three axes.
Many thanks
Alex
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 10 de Nov. de 2023
Editada: Dyuman Joshi el 10 de Nov. de 2023
On which values do you want to get the error bars?
And what should be the relative sizes of the error bars?
Note that sizes includes the length above and below the curve, as the error bars shown in the sample figure are unequal in lengths across the curve.
A Poyser
A Poyser el 10 de Nov. de 2023
The strength_MPa data is what I wish to make the error bar graph for. The error bars for this graph vary from point to point. So for example the first error bar at 20 on the x axis ranges from 2880 - 3990 with 3280 being the mid point on the y axis. the second error bar at 1200 on the x axis ranges from 2000 - 3500 with 2990 being the mid point of the line, and so on.

Iniciar sesión para comentar.

Respuesta aceptada

Voss
Voss el 10 de Nov. de 2023
Editada: Voss el 10 de Nov. de 2023
Strength_Mpa = [
20 2880
20 3280
20 3990
1200 2000
1200 2990
1200 3500
1300 2200
1300 2700
1300 3280
1400 1390
1400 1770
1400 2150 ];
Grainsize_nm = [
25 90
1200 120
1300 150
1350 310
1400 450
1500 790 ];
y = reshape(Strength_Mpa,3,[]);
x = y(1,1:end/2);
y_min = y(1,end/2+1:end);
y_mid = y(2,end/2+1:end);
y_max = y(3,end/2+1:end);
yyaxis left
errorbar(x,y_mid,y_mid-y_min,y_max-y_mid)
ylim([0 4500])
ylabel('Strength [MPa]')
hold on
yyaxis right
plot(Grainsize_nm(:,1),Grainsize_nm(:,2),'-ro','MarkerFaceColor','r')
ylim([0 900])
ylabel('Grain size [nm]')

Más respuestas (0)

Categorías

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

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by