Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

When applying the subplot() function in Matplotlib, its position is important

I did the reading on Day 63. Day 62 [October 8, 2025] I need to buckle down, as I'm still lagging on day 2's remaining goals, day 3 & 4 goals, "Day 3-4: Control structures (if-else, loops)", as well as day 5 (and 6) goals, "Day 5-6:…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I did the reading on Day 63.

Day 62 [October 8, 2025]



I need to buckle down, as I'm still lagging on day 2's remaining goals, day 3 & 4 goals, "Day 3-4: Control structures (if-else, loops)", as well as day 5 (and 6) goals, "Day 5-6: Functions and modules", and Day 7 target (exercises) (Meta AI, personal communication, August 8, 2025). If I haven't covered this, I can't make progress on day 8 - 61 goals.



Goals:

As extracted from the 'Python for Software Development' textbook by Halvorsen (n.d.):




  • The New Age of Programming ✅

  • What is Python? ✅

  • Introduction to Python ✅

  • Interpreted vs. Compiled ✅

  • Python Packages ✅

  • Python Packages for Science and Numerical Computations ✅

  • Python Editors ✅

  • Python IDLE ✅

  • Visual Studio Code ✅

  • Variables ✅

  • Numbers ✅

  • Strings ✅

  • String Input✅

  • Built-in Functions✅

  • Python Standard Library✅

  • Using Python Libraries, Packages and Modules✅

  • Python Packages✅

  • Plotting in Python ✅

  • Subplots✅

  • Exercises

  • If ... Else

  • Arrays

  • For Loops

  • Nested

  • For Loops

  • While Loops

  • Exercises

  • Creating Functions in Python - Introduction

  • Functions with multiple return values

  • Exercises

  • Creating Classes in Python

  • The init () Function

  • Exercises

  • Creating Python Modules

  • Exercises



Notes:

'Python for Software Development' textbook by Halvorsen (n.d.):

Today, I worked on the following exercise (Halvorsen, n.d.):

"Create sin(x) and cos(x) in 2 different plots.

You should use all the Plotting functions listed below in your code:

• plot()

• title()

• xlabel()

• ylabel()

• axis()

• grid()

• legend()

• show()"



After trial and error, here is my code:



import matplotlib.pyplot as plt

import numpy as np



xStart = 0

xEnd = 2*np.pi

increment = 0.5



x = np.arange(xStart, xEnd, increment)

y = np.sin(x)

plt.plot(x,y,'g')

plt.xlabel('x')

plt.ylabel('sin(x)')

plt.title('SINE GRAPH')

plt.subplot(2,1,1)

plt.grid()

plt.show()



x = np.arange(xStart, xEnd, increment)

y = np.cos(x)

plt.plot(x,y,'r')

plt.xlabel('x')

plt.ylabel('cos(x)')

plt.title('COSINE GRAPH')

plt.subplot(2,1,2)

plt.grid()

plt.show()



However, it is off, from what they did in their own previous similar example as shown:

import matplotlib.pyplot as plt

import numpy as np



xstart = 0

xstop = 2*np.pi

increment = 0.1



x = np.arange(xstart, xstop, increment)



y = np.sin(x)



z = np.cos(x)



plt.subplot(2,1,1)

plt.plot(x,y,'g')

plt.title('sin')

plt.xlabel('x')

plt.ylabel('sin(x)')

plt.grid()

plt.show()



plt.subplot(2,1,2)

plt.plot(x,z,'r')

plt.title('cos')

plt.xlabel('x')

plt.ylabel('cos(x)')

plt.grid()

plt.show()



---Mine was causing the plot to look funny.



I noticed that difference basically was the positioning of plt.subplot(2,1,1) and plt.subplot(2,1,2) respectively.



Rearranging mine, also solved the problem:

import matplotlib.pyplot as plt

import numpy as np



xStart = 0

xEnd = 2*np.pi

increment = 0.5



x = np.arange(xStart, xEnd, increment)

y = np.sin(x)

plt.subplot(2,1,1)

plt.plot(x,y,'g')

plt.xlabel('x')

plt.ylabel('sin(x)')

plt.title('SINE GRAPH')

plt.grid()

plt.show()



x = np.arange(xStart, xEnd, increment)

y = np.cos(x)

plt.subplot(2,1,2)

plt.plot(x,y,'r')

plt.xlabel('x')

plt.ylabel('cos(x)')

plt.title('COSINE GRAPH')

plt.grid()

plt.show()



The functions axis() and legend() were not also used in my code. Quite frankly, I have no idea what they do. I'll begin my study on these tomorrow.



Summary:

When applying the subplot() function in Matplotlib, its position is important.



References:




  1. Halvorsen, H. (n.d.). Python. https://halvorsen.blog/documents/programming/python/python.php#python4

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten When applying the subplot() function in Matplotlib, its position is important

Thematisch verwandte Begriffe: When, applying, subplot, function · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-18163 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick