Editing the starting points of different lines in a graph (2024)

25 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Mahmut Cenk vor etwa 17 Stunden

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph

Kommentiert: Mahmut Cenk vor etwa 15 Stunden

Akzeptierte Antwort: Manikanta Aditya

  • untitled.jpg

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 Kommentare

1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206691

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206691

Depends on what you are trying to show via the plot. If this is some data you measured, I would not play with it unless it is a simple time shift you want to do or something. It is not ethical in the scientific community to manipulate data.

Manikanta Aditya vor etwa 17 Stunden

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206696

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206696

Makes sense

Mahmut Cenk vor etwa 15 Stunden

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206781

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#comment_3206781

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.

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Akzeptierte Antwort

Manikanta Aditya vor etwa 17 Stunden

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#answer_1483326

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2135791-editing-the-starting-points-of-different-lines-in-a-graph#answer_1483326

In MATLAB Online öffnen

Hi @Mahmut Cenk,

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')

Editing the starting points of different lines in a graph (6)

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!

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Tags

  • plot
  • axis scaling
  • axis modification

Produkte

  • MATLAB

Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by Editing the starting points of different lines in a graph (7)

Editing the starting points of different lines in a graph (8)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Kontakt zu Ihrer lokalen Niederlassung

Editing the starting points of different lines in a graph (2024)
Top Articles
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5282

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.