Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••
IT NachrichtenMicrosoft puts Brad Smith in charge of communications(25.09.2026 um 00:08 Uhr)
••
IT Nachrichten25. September(25.09.2026 um 00:05 Uhr)
•
IT NachrichtenCI-Solution GmbH von Crossware übernommen(25.09.2026 um 00:01 Uhr)
•
IT NachrichtenInsta360 GO Ultra erhält KI-Sprachassistenten mit Gemini(24.09.2026 um 21:30 Uhr)
••
AI & KI NachrichtenMaryland Governor Draws New Boundaries for Data Centers(25.09.2026 um 00:04 Uhr)
••••
IT NachrichtenMicrosoft puts Brad Smith in charge of communications(25.09.2026 um 00:08 Uhr)
••
IT Nachrichten25. September(25.09.2026 um 00:05 Uhr)
•
IT NachrichtenCI-Solution GmbH von Crossware übernommen(25.09.2026 um 00:01 Uhr)
•
IT NachrichtenInsta360 GO Ultra erhält KI-Sprachassistenten mit Gemini(24.09.2026 um 21:30 Uhr)
••
AI & KI NachrichtenMaryland Governor Draws New Boundaries for Data Centers(25.09.2026 um 00:04 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

Plotting and Data Visualization with Matplotlib

Working with raw data in the form of a CSV (comma-separated value) does not visually tell a story. However, if done right with a visualization library like Matplotlib, your users tend to appreciate you because they can connect the dots…

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

Working with raw data in the form of a CSV (comma-separated value) does not visually tell a story. However, if done right with a visualization library like Matplotlib, your users tend to appreciate you because they can connect the dots easily with visuals.



This article is an introduction to using Matplotlib for plotting and data visualizations.






GitHub Repo



Check the complete source code in this repo.






What is Matplotlib



Matplotlib is a Python plotting library that allows you to turn data into pretty visualizations, also known as plots or figures.



The following reasons are why Matplotlib is necessary for data scientists:




  • It is built on NumPy arrays (and Python)

  • Integrates directly with Pandas

  • Can create basic or advanced plots






Importing Matplotlib



To start with Matplotlib, import it into your Jupyter Notebook like this:




%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np








  • %matplotlib inline: this magic command with the percentage sign in front of matplotlib helps make sure all matplotlib plots and graphs appear within the notebook



The simplest way to create a plot is with:




plt.plot();






plot figure



Let's add some data to the plot:




x = [1, 2, 3, 4]
y = [11, 22, 33, 44]
plt.plot(x, y);






This code shows the plot values on the plot figure's x and y axes.



plotting a graph on the x and y axes



The recommended way of plotting a graph is using this method, which should give the same result as the previous method:




fig, ax = plt.subplots()
ax.plot(x, y);






Note: Changing the x and y should return an entirely different graph.






Anatomy of Matplotlib Plot



The representation of a typical workflow of a Matplotlib figure includes:




  • A plot axes title

  • Legend

  • y-axis label

  • x-axis label



Let's see an example of the workflow.




# 0. import matplotlib and get it ready for plotting in Jupyter
%matplotlib inline
import matplotlib.pyplot as plt

# 1. Prepare data
x = [1, 2, 3, 4]
y = [11, 22, 33, 44]

# 2. Setup plot
fig, ax = plt.subplots(figsize=(10, 10))

# 3. Plot data
ax.plot(x, y)

# 4. Customize plot
ax.set(title = "Simple plot",
xlabel = "x-axis",
ylabel = "y-axis")

# 5. Save & show (you have to save the whole figure)
fig.savefig("images/sample-plot.png")






The code above shows that you can set a title with the ax.set() method and save the plot as a .png file in the images folder.



matplotlib workflow






Creating Figures with NumPy arrays



In this section, you will create different plots like scatter and bar, but there are others like histograms, lines, and subplots.



Copy-paste this code in your notebook:




import numpy as np
x = np.linspace(0, 10, 100)
x[:10]






linspace: returns evenly spaced numbers over a specified interval. Also, the index of x displays only the first ten results.



Plot the data and create a line plot:




fig, ax = plt.subplots()
ax.plot(x, x**2);






You should see something like this:



line plot



For a scatter plot, use the same data from above:




fig, ax = plt.subplots()
ax.scatter(x, np.exp(x));






Note: Instead of using .plot() on ax axes, switch to using .scatter().



Scatter plot



Working with dictionaries and making a plot:




nut_butter_prices = {"Almond butter": 10, "Peanut butter": 9, "Cashew butter": 5}

fig, ax = plt.subplots()
ax.bar(nut_butter_prices.keys(), nut_butter_prices.values())
ax.set(title = "Teri's Nut Butter Store",
ylabel = "Price ($)"
);






bar plot



Horizontal Bar

Another way of creating a plot is plotting a horizontal bar with .barh.




fig, ax = plt.subplots()
ax.barh(list(nut_butter_prices.keys()), list(nut_butter_prices.values()));






horizontal bar



Subplots and Histograms

You can turn a single figure into subplots of four equal parts with this code:




# Subplots option 1
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(
nrows = 2,
ncols = 2,
figsize = (10, 5)
)

# Plot to each different axes
ax1.plot(x, x / 2);
ax2.scatter(np.random.random(10), np.random.random(10));
ax3.bar(nut_butter_prices.keys(), nut_butter_prices.values());
ax4.hist(np.random.randn(1000));






subplots




# subplots option 2
fig, ax = plt.subplots(nrows = 2,
ncols = 2,
figsize = (10, 5))

# Plot to each different index
ax[0, 0].plot(x, x/2);
ax[0, 1].scatter(np.random.random(10), np.random.random(10));
ax[1, 0].bar(nut_butter_prices.keys(), nut_butter_prices.values());
ax[1, 1].hist(np.random.randn(1000));






subplots






Plotting from Pandas DataFrame



This section will show you how to use the Pandas DataFrame to visualize data using a .csv file.



Download the car sales data



Before using an imported to read and use it, first import the pandas library:




import pandas as pd






Make a DataFrame with this command:




car_sales = pd.read_csv("car_sales.csv")
car_sales






Reading the car sales data is saved in the root directory of the main Python notebook. But if you save it in a folder, you must reference it in the .read_csv() method.



Car sales data



To remove the $ sign and turn it into an integer data type, run this command, which is in regex:




car_sales['Price']=car_sales['Price'].str.replace('$','',regex=False).str.replace(',','',regex=False).astype(float).astype(int)
car_sales






adjusted car sales price data



Add a Sale Date Column:




car_sales["Sale Date"] = pd.date_range("1/1/2023", periods=len(car_sales))
car_sales






sale date column



Add Total Sales Column:




car_sales["Total Sales"] = car_sales["Price"].cumsum()
car_sales






Plot the Total Sales:




car_sales.plot(x = "Sale Date", y = "Total Sales")






total sales



Repeat the same process to plot with any column axis just like this:




car_sales.plot(x="Odometer (KM)", y = "Price", kind = "scatter");






Scatter plot






In Summary



Matplotlib creates beautiful visualization depending on what you want to achieve, as it is rich with various options to spice up your data and make it visually appealing.






Resources



SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Plotting and Data Visualization with Matplotlib
id: caf106c0-c491-4f18-8287-b9908fcadfdc
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-25
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-25"
        description = "YARA Signature for "
    strings:
        $str = "Plotting and Data Visualizatio" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Plotting and Data Visualization with Mat")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*Plotting and Data Visualization with Mat*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Plotting and Data Visualization with Mat"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Plotting and Data Visualization with Mat.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Plotting and Data Visualization with Matplotlib

Thematisch verwandte Begriffe: Plotting, Data, Visualization, with · 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-82585 | The Botslab G980H dash camera firmware transmits sensitive information o…
Advisory →
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
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
📂 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 TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle