Azzera filtri
Azzera filtri

Editing the starting points of different lines in a graph

5 visualizzazioni (ultimi 30 giorni)
Hello everyone, sorry for bothering you with a rookie question again. Suppose I do have a graph in which there are lines with different starting x-values so they start from different points along x-axis. Is there possibly a way to somehow rescale the x-axis, or to modify it in a manner such that the lines start from the same point along the x-axis; as if the x1 and x2 vectors in the code below had the same first value? Or would you think that, if the graph stayed like that, this would decrease the chances that my paper would be accepted by a journal, regardless of the quartile?
Thanks in advance!
x1 = [1, 2 ,3, 4, 5];
y1 = [5, 3, 2.8, 1.7, 1.2];
y2 = [6.5, 4.7, 3.5, 1.9, 1.3];
x2 = [2.1, 3.6, 3.8, 4, 5];
y3 = [6, 5.6, 3.1, 2.9, 1.7];
y4 = [5, 4.1, 3.8, 2, 1.5];
y5 = [5, 4, 3, 1.8, 1.4];
plot(x1,y1,x1,y2,'color', 'g'); %Model 1
hold on
plot(x2,y3,x2,y4,x2,y5,'color', 'b'); %Model 2
hold off
grid minor
xlabel('x values')
ylabel('y values')
title('figure 1')
  3 Commenti
Mahmut Cenk
Mahmut Cenk il 9 Lug 2024
Thanks a lot @Manikanta Aditya, this worked perfectly. And yes @Aquatris you are right. Actually these are just some arbitrary figures, my actual results are different from these and of course, data is much more. My work is completely numerical; actually I used Ansys Fluent for my analyses. Nonetheless, I will leave it as it is for the time being. If any comment would be made on the presentation of the graphs, I might just do the shifting and explain it clearly.

Accedi per commentare.

Risposta accettata

Manikanta Aditya
Manikanta Aditya il 9 Lug 2024
To make the lines start from the same point along the x-axis, you could subtract the minimum value of each x-vector from all its elements. This would effectively “shift” your data so that each line starts from x=0.
Here is the modified code:
x1 = [1, 2 ,3, 4, 5];
y1 = [5, 3, 2.8, 1.7, 1.2];
y2 = [6.5, 4.7, 3.5, 1.9, 1.3];
x2 = [2.1, 3.6, 3.8, 4, 5];
y3 = [6, 5.6, 3.1, 2.9, 1.7];
y4 = [5, 4.1, 3.8, 2, 1.5];
y5 = [5, 4, 3, 1.8, 1.4];
% Shift x values
x1 = x1 - min(x1);
x2 = x2 - min(x2);
plot(x1,y1,x1,y2,'color', 'g'); %Model 1
hold on
plot(x2,y3,x2,y4,x2,y5,'color', 'b'); %Model 2
hold off
grid minor
xlabel('Shifted x values')
ylabel('y values')
title('figure 1')
As for your question about journal acceptance, it’s hard to say definitively as it can depend on the specific journal and the context of your research. However, clarity and accuracy in presenting your data are always important. If the original x-values have specific meanings or implications in your study, shifting them might lead to confusion.
I hope this helps!

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by