Data Visualization Articles

Page 45 of 68

How to make custom grid lines in Seaborn heatmap?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 5K+ Views

To make custom grid lines in Seaborn heatmap, we can use linewidths and linecolor parameters in the heatmap() method. These parameters allow you to control the thickness and color of the lines that separate cells in the heatmap. Basic Custom Grid Lines Here's how to create a heatmap with custom grid lines ? import seaborn as sns import pandas as pd import numpy as np import matplotlib.pyplot as plt # Set figure size plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True # Create sample data df = pd.DataFrame(np.random.random((5, 5)), ...

Read More

How to plot scatter points in a 3D figure with a colorbar in Matplotlib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 3K+ Views

To create 3D scatter plots with colorbars in Matplotlib, we use the scatter() method on a 3D axes object along with colorbar() to display a color scale. The colorbar helps visualize how point colors relate to data values. Basic 3D Scatter Plot with Colorbar Here's how to create a 3D scatter plot where point colors are mapped to one of the coordinate values ? import numpy as np import matplotlib.pyplot as plt # Set figure size plt.rcParams["figure.figsize"] = [10, 8] plt.rcParams["figure.autolayout"] = True # Create figure and 3D axis fig = plt.figure() ax = ...

Read More

Line colour of a 3D parametric curve in Python's Matplotlib.pyplot

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 488 Views

To create a 3D parametric curve with customized line colors in Matplotlib, we need to generate parametric equations and apply color mapping based on parameter values. This technique is useful for visualizing how curves change through parameter space. Steps to Create a Colored 3D Parametric Curve Set the figure size and adjust the padding between and around the subplots. Create a new figure or activate an existing figure using figure() method. Add an axis as a subplot arrangement with 3D projection. To make a parametric curve, initialize theta, z, r, x and y variables. Plot x, y ...

Read More

How do I display real-time graphs in a simple UI for a Python program?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 917 Views

To display real-time graphs in a simple UI for a Python program, we can use matplotlib with FuncAnimation to create animated plots that update continuously. This approach is perfect for visualizing changing data streams or simulated real-time data. Required Libraries First, ensure you have the necessary libraries installed − pip install matplotlib numpy Basic Real-Time Line Plot Here's a simple example that displays a real-time line graph with updating sine wave data − import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # Set up the figure ...

Read More

How to show mean in a box plot in Python Matploblib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 3K+ Views

To show the mean in a box plot using Matplotlib, we can use the showmeans=True parameter in the boxplot() method. This displays the mean as a marker (typically a triangle) on each box. Basic Box Plot with Mean Let's create a simple box plot that displays the mean for each dataset ? import matplotlib.pyplot as plt import numpy as np # Create sample data data = np.random.rand(100, 3) # Create box plot with mean displayed plt.figure(figsize=(8, 6)) bp = plt.boxplot(data, showmeans=True) plt.title('Box Plot with Mean Values') plt.xlabel('Dataset') plt.ylabel('Values') plt.show() Customizing Mean ...

Read More

How to shade points in a scatter based on colormap in Matplotlib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 669 Views

To shade points in a scatter plot based on a colormap, we can use the c parameter to specify colors and cmap parameter to apply a colormap. This creates visually appealing scatter plots where point colors represent data values. Basic Scatter Plot with Colormap Here's how to create a scatter plot with copper colormap shading − import numpy as np import matplotlib.pyplot as plt # Set figure size plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True # Create random data points x = np.random.rand(100) y = np.random.rand(100) # Create scatter plot with copper colormap ...

Read More

How to use a custom png image marker in a plot (Matplotlib)?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 5K+ Views

To use a custom PNG or JPG image as a marker in a plot, we can use Matplotlib's OffsetImage and AnnotationBbox classes. This technique allows you to place images at specific coordinates instead of traditional point markers. Required Components The key components for image markers are ? OffsetImage: Converts image files into plottable objects AnnotationBbox: Positions images at specific coordinates Image paths: List of image file locations Coordinates: X and Y positions for each image Example Here's how to create a plot with custom image markers ? import matplotlib.pyplot as plt ...

Read More

How to plot a 3D continuous line in Matplotlib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 6K+ Views

To plot a 3D continuous line in Matplotlib, you need to create three-dimensional data points and use the plot() method with 3D projection. This creates smooth curves in three-dimensional space. Basic Steps Follow these steps to create a 3D continuous line plot ? Import required libraries (NumPy and Matplotlib) Create x, y, and z data points using NumPy Create a figure with 3D projection using add_subplot() Plot the data using plot() method Display the figure using show() method Example: ...

Read More

Matplotlib animation not working in IPython Notebook?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 3K+ Views

Matplotlib animations often don't display properly in IPython/Jupyter notebooks due to backend configuration issues. This article shows how to create working animations in notebooks using the proper setup and methods. Common Issues with Notebook Animations The main problems are ? Default matplotlib backend doesn't support animations in notebooks Missing magic commands for inline display Incorrect animation display methods Solution: Enable Notebook Animation Support First, configure the notebook to display animations properly ? %matplotlib notebook # Alternative: %matplotlib widget (for newer JupyterLab) import numpy as np import matplotlib.pyplot as plt import ...

Read More

Changing the color and marker of each point using Seaborn jointplot

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 25-Mar-2026 1K+ Views

Seaborn's jointplot creates scatter plots with marginal distributions. To customize individual point colors and markers, we need to clear the default plot and manually add points with different styling. Basic Jointplot Structure First, let's create a basic jointplot to understand the structure ? import matplotlib.pyplot as plt import seaborn as sns import numpy as np # Set figure parameters plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True # Load sample data tips = sns.load_dataset("tips") print(f"Dataset shape: {tips.shape}") print(tips.head(3)) Dataset shape: (244, 7) total_bill tip ...

Read More
Showing 441–450 of 680 articles
« Prev 1 43 44 45 46 47 68 Next »
Advertisements