Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••••••••••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

If the function plt.axis() is called without arguments, the current axis limits are returned by it.

If the function plt.axis() is called without arguments, the current axis limits are returned by it in tuple format (xmin, xmax, ymin, ymax), estimated…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

If the function plt.axis() is called without arguments, the current axis limits are returned by it in tuple format (xmin, xmax, ymin, ymax), estimated automatically and with the addition of a little padding to ensure proper capture of all the data.



I did the reading on Day 64.

Day 63 [October 9, 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 - 62 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.):

On day 62, I worked on the exercise in Halvorsen, n.d., page 51, and came to this solution after corrections:



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



But the functions axis() and legend() were not used in my code. Today I want to study what they do.



plt.axis() (geeksforgeeks, 2025):




  • To customize the coordinate system and view of the plot

  • To have the properties of the x- and y-axis set or obtained in a plot

  • Axis limits can be obtained or set i.e. xmin, xmax, ymin, ymax

  • For the setting of the plot's aspect ration i.e. 'auto', 'numeric ratio', or 'equal']

  • With 'tight', the data can be surrounded with tight layout



If the function plt.axis() is called without arguments, the current axis limits are returned by it i.e. [xmin, xmax, ymin, ymax], and this tells us the x and y ranges (which are also estimated automatically] which bound the plot, as the following example shows (geeksforgeeks, 2025):



import matplotlib.pyplot as plt



plt.plot([1,2,3],[4,5,6])

print(plt.axis())



Which outputs:

(np.float64(0.9), np.float64(3.1), np.float64(3.9), np.float64(6.1)),

aside the plot (shown diagrammatically, though not shown here).



I didn't understand this output, so I asked Google (2025). Here are some lessons




  • "The limits are returned as a tuple in the format (xmin, xmax, ymin, ymax)"

  • The limits are estimated automatically

  • NumPy's 64-bit floating-point numbers are shown as np.float64

  • When the axis limits are being set, little padding are added within the bounds of the data points by matplotlibe automatically, making certain that no part of the data is invisible including the edges of the plot.



If the function plt.axis() is called without arguments, the current axis limits are returned by it i.e. [xmin, xmax, ymin, ymax], which are returned in tuple format (xmin, xmax, ymin, ymax), estimated automatically and when these axis limits are being set, little padding are added within the bounds of the data points by matplotlibe automatically, making certain that no part of the data is invisible including the edges of the plot (geeksforgeeks, 2025; Google, 2025).



Summary:

If the function plt.axis() is called without arguments, the current axis limits are returned by it in tuple format (xmin, xmax, ymin, ymax), estimated automatically and with the addition of a little padding to ensure proper capture of all the data.



References:




  1. geeksforgeeks. (2025, July 12). Matplotlib.pyplot.axis() in python. https://www.geeksforgeeks.org/python/matplotlib-pyplot-axis-in-python/


  2. Google. (2025). Google Search with AI. [Large language model]. https://www.google.com/search?q=explain+Selection+deleted+import+matplotlib.pyplot+as+plt+plt.plot(%5B1%2C2%2C3%5D%2C%5B4%2C5%2C6%5D)+print(plt.axis())+(np.float64(0.9)%2C+np.float64(3.1)%2C+np.float64(3.9)%2C+np.float64(6.1))&oq=explain+Selection+deleted+import+matplotlib.pyplot+as+plt+plt.plot(%5B1%2C2%2C3%5D%2C%5B4%2C5%2C6%5D)+print(plt.axis())+(np.float64(0.9)%2C+np.float64(3.1)%2C+np.float64(3.9)%2C+np.float64(6.1))&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCDM0NDlqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8&zx=1760134615594&no_sw_cr=1


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


2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten If the function plt.axis() is called without arguments, the current axis limits are returned by it.

Thematisch verwandte Begriffe: function, pltaxis, called, without · 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 ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
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