Plotting two x-Axes with numbers and dates (2024)

111 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Nikolai Block am 14 Jul. 2017

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates

Bearbeitet: dpb am 27 Dez. 2022

Akzeptierte Antwort: dpb

In MATLAB Online öffnen

I need to plot two x-axes with the same y-axis.

The first are the dates of a Satellite mission, the second one represents the distance.

I made the dates already as a string with the function "dates". So i just need to know what i have to add to:

h = figure

plot (dates,R_plot(:,1),'-','MarkerSize',6,'Color',colorset(5))

ylim([0 10000])

title ('Data rate over distance');

xlabel ('Distances in AU');

ylabel ('consequential data rate in bit/s');

I've been googling already the function "line" to just create another line, but it wasn't working out with a datestring for me.

I use Matlab2016b and i am quite new.

1 Kommentar

-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

S. Gokhun Tanyer am 27 Dez. 2022

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_2536972

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_2536972

I was searching for the same exact thing.

It is too bad there are no solutions listed here. :(

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Akzeptierte Antwort

dpb am 15 Jul. 2017

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#answer_274228

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#answer_274228

Bearbeitet: dpb am 27 Dez. 2022

See <graph-with-multiple-x-axes> for example. They've really made it hard to find the link; I never did find it in current doc; had to look it up in R2014b where I knew it existed to find the phrase and then do a text search... :( And, since they built yyaxis in lieu of old plotyy, why wouldn't they have gone ahead and introduced xxaxis as well? Makes no sense what TMW does/doesn't do sometimes...

"made dates already as a string with the function "dates" " I don't find any function dates; do you mean datestr, perhaps? If so, you want to plot using a datetime value and format it as desired, not a string.

3 Kommentare

1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden

dpb am 15 Jul. 2017

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_469272

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_469272

In MATLAB Online öffnen

[Moved Nikolai's Answer to Comment...dpb]

You are right! I was using "datetime". I already found the same page you have been sending. But i still don't know how to change the second x-Axis to a datetime Value.

My Solution right now is to first plot the dates and afterwards the distances:

h = figure

plot (dates,R_plot(:,1),'-','MarkerSize',6,'Color',colorset(5))

ylim([0 10000])

xlabel ('Distances in AU');

ylabel ('consequential data rate in bit/s');

ax1 = gca;

ax1_pos = ax1.Position;

ax2 = axes('Position',ax1_pos,...

'XAxisLocation','top',...

'YAxisLocation','right',...

'Color','none');

%Eliminating second y-Axis

set(gca,'ytick',[])

% With AU_ent as the distances in AU

x2 = AU_ent;

%Random value

y2 = 0;

line(x2,y2,'Parent',ax2,'Color','k')

Even i did not find the perfect solution, Many thanks for your help!

dpb am 15 Jul. 2017

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_469274

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_469274

In MATLAB Online öffnen

I'm still not positive what it is you're wanting here, Nikolai (which is why I didn't try specific code first go 'round; wasn't sure what code to give :) ).

To set the second axis in time units you need to set the x-axis limits in terms of time values and plot the data in those units as well. Can you attach some sample of what the resulting graph you're after would look like; even a sketch by hand would suffice, probably.

BTW, if you want two axes to be the same and stay in synch with each other, look at

doc linkaxes

for way to get that behavior.

dpb am 9 Mär. 2018

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_543691

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/348793-plotting-two-x-axes-with-numbers-and-dates#comment_543691

In MATLAB Online öffnen

"what if I have data points and I don't want to have a line. Plot does not seem to work" -- Maxime Penning -- Answer moved to comment by dpb

Use the optional syntax to specify linestyle without a line type.

plot(x,y,'g.')

plots with green dots. doc plot for the details in the fine print on arguments.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABGraphicsFormatting and AnnotationLabels and AnnotationsAnnotations

Mehr zu Annotations finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

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 Plotting two x-Axes with numbers and dates (7)

Plotting two x-Axes with numbers and dates (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

Plotting two x-Axes with numbers and dates (2024)

References

Top Articles
Entdecke Südostasien – Kultur & Küsten von G Adventures mit 86 Kundenbewertungen (Code: ATID)
Gmail : messagerie privée et sécurisée pour un usage personnel ou professionnel | Google Workspace
Automated refuse, recycling for most residences; schedule announced | Lehigh Valley Press
Tiny Tina Deadshot Build
T Mobile Rival Crossword Clue
Kansas Craigslist Free Stuff
Florida (FL) Powerball - Winning Numbers & Results
Spelunking The Den Wow
Ukraine-Russia war: Latest updates
Voyeuragency
Winterset Rants And Raves
A Guide to Common New England Home Styles
R/Afkarena
Bjork & Zhulkie Funeral Home Obituaries
ocala cars & trucks - by owner - craigslist
RBT Exam: What to Expect
This Modern World Daily Kos
Maplestar Kemono
Rams vs. Lions highlights: Detroit defeats Los Angeles 26-20 in overtime thriller
Uktulut Pier Ritual Site
Royal Cuts Kentlands
Www.publicsurplus.com Motor Pool
Jenna Ortega’s Height, Age, Net Worth & Biography
Tripadvisor Napa Restaurants
Mj Nails Derby Ct
Watch Your Lie in April English Sub/Dub online Free on HiAnime.to
Aliciabibs
15 Primewire Alternatives for Viewing Free Streams (2024)
Criterion Dryer Review
Bridgestone Tire Dealer Near Me
Pipa Mountain Hot Pot渝味晓宇重庆老火锅 Menu
Star News Mugshots
Roadtoutopiasweepstakes.con
Nail Salon Open On Monday Near Me
Capital Hall 6 Base Layout
Worlds Hardest Game Tyrone
آدرس جدید بند موویز
Nacho Libre Baptized Gif
Covalen hiring Ai Annotator - Dutch , Finnish, Japanese , Polish , Swedish in Dublin, County Dublin, Ireland | LinkedIn
oklahoma city community "puppies" - craigslist
Admissions - New York Conservatory for Dramatic Arts
Compare Plans and Pricing - MEGA
Froedtert Billing Phone Number
Sam's Club Gas Prices Florence Sc
Craigslist Mexicali Cars And Trucks - By Owner
301 Priest Dr, KILLEEN, TX 76541 - HAR.com
Seminary.churchofjesuschrist.org
'Guys, you're just gonna have to deal with it': Ja Rule on women dominating modern rap, the lyrics he's 'ashamed' of, Ashanti, and his long-awaited comeback
Wordle Feb 27 Mashable
Deezy Jamaican Food
Air Sculpt Houston
This Doctor Was Vilified After Contracting Ebola. Now He Sees History Repeating Itself With Coronavirus
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 6103

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.