Python Plotly – How to simultaneously apply color/shape/size in a Scatter Plot?

Vani Nalliappan
Updated on 26-Mar-2026 22:27:49

1K+ Views

Plotly is an open-source Python library for creating interactive web-based visualizations. In this tutorial, we'll explore how to simultaneously apply color, shape, and size properties to scatter plots for enhanced data visualization. Understanding Scatter Plot Properties Scatter plots can be customized with multiple visual properties: Color − Maps data values to different colors using color scales Size − Varies marker sizes based on data values Shape − Uses different marker symbols to represent categories Basic Scatter Plot with Color and Size Let's create a scatter plot where color and size represent different data ... Read More

How to show legend and label axes in 3D scatter plots in Python Plotly?

Vani Nalliappan
Updated on 26-Mar-2026 22:27:23

1K+ Views

Plotly is an open-source Python library for creating interactive charts and visualizations. In 3D scatter plots, properly showing legends and labeling axes is crucial for data interpretation and presentation clarity. This tutorial demonstrates how to create 3D scatter plots with customized legends and axis labels using plotly.express and pandas. Basic 3D Scatter Plot Setup First, let's create a simple 3D scatter plot with our sample data − import plotly.express as px import pandas as pd # Create sample data data = { 'gadget': ['mobile', 'tablet', 'ipad', 'laptop'], ... Read More

How to hide the Y-axis tick labels on a chart in Python Plotly?

Vani Nalliappan
Updated on 26-Mar-2026 22:26:58

6K+ Views

Plotly is an open-source Python plotting library for creating interactive charts and visualizations. One common customization is hiding Y-axis tick labels to create cleaner charts or when the exact values are not needed. In this tutorial, we will explore different methods to hide Y-axis tick labels using Plotly's graph_objects module and layout properties. Method 1: Using showticklabels Property The simplest approach is to set the showticklabels property to False in the Y-axis layout ? import plotly.graph_objects as go # Create a bar chart with hidden Y-axis tick labels fig = go.Figure( ... Read More

How to display an image on hovering over a point in Python Plotly?

Vani Nalliappan
Updated on 26-Mar-2026 22:26:38

6K+ Views

Plotly is a powerful visualization library that allows you to create interactive plots with hover effects. In this tutorial, we'll learn how to display images when hovering over data points using Plotly with Dash. Prerequisites First, install the required libraries ? pip install plotly dash pandas Understanding the Approach To display images on hover, we need three key components: Custom data − Store image URLs in the plot data Hover callback − Detect when user hovers over points Dynamic image display − Update the image source based on hover data ... Read More

Python Plotly: How to define the structure of a Sankey diagram using a Pandas dataframe?

Vani Nalliappan
Updated on 26-Mar-2026 22:26:07

3K+ Views

A Sankey diagram is used to visualize flow between nodes by defining a "source" and "target" relationship. It effectively represents the movement of objects or data between different points in a system. In this tutorial, we'll learn how to define the structure of a Sankey diagram using a Pandas dataframe. We will use the plotly.graph_objects module to create interactive flow diagrams. Required Libraries First, import the necessary libraries ? import plotly.graph_objects as go import pandas as pd Creating Node Data Structure Define nodes with their IDs, labels, and colors ? ... Read More

How to set the font style to Bold in Python Plotly?

Vani Nalliappan
Updated on 26-Mar-2026 22:25:37

8K+ Views

Plotly is an open-source Python library for creating interactive charts and visualizations. You can customize font styles, including making text bold, using various methods. In this tutorial, we will show how to set font styles to bold in Python Plotly. Methods to Make Text Bold in Plotly There are several ways to make text bold in Plotly ? Use HTML tags in titles and annotations Set font_family to bold fonts like "Arial Black" Use font_weight property for specific elements Method 1: Using HTML Tags for Bold Titles The simplest way to make ... Read More

How to show a Plotly animated slider in Python?

Vani Nalliappan
Updated on 26-Mar-2026 22:25:11

2K+ Views

Plotly supports creating interactive animated visualizations with sliders that allow users to control the animation timeline. In this tutorial, we will show how to create an animated scatter plot with a slider using plotly.express. Key Components plotly.express − Used to generate interactive figures with built-in animation support animation_frame − Defines which column to use for animation frames animation_group − Groups data points that should animate together Creating Sample Data Since external CSV files aren't available online, let's create sample data to demonstrate the animated slider ? import plotly.express as px import pandas ... Read More

Write a Python code to sort an array in NumPy by the nth column?

Vikram Chiluka
Updated on 26-Mar-2026 22:24:42

3K+ Views

In this article, we will show you how to sort an array in NumPy by the nth column both in ascending and descending order in Python. NumPy is a Python library designed to work efficiently with arrays in Python. It is fast, simple to learn, and efficient in storage. NumPy arrays can be sorted by any column using the argsort() function, which returns the indices that would sort the array. Method 1: Sorting by a Specific Column (Ascending) The argsort() function performs an indirect sort and returns indices that would sort the array. We can use these ... Read More

Why you should use NumPy arrays instead of nested Python lists?

Vikram Chiluka
Updated on 26-Mar-2026 22:24:17

3K+ Views

NumPy arrays offer significant advantages over nested Python lists for numerical computing. They provide better performance, memory efficiency, and vectorized operations that make mathematical computations much faster and cleaner. Python Nested Lists A Python list is a mutable and ordered collection of elements denoted by square brackets. While flexible, nested lists have several limitations ? # Creating a nested list nested_data = [[2, 7, 8], [1, 5, 4]] print("Nested list:", nested_data) print("Type of elements:", type(nested_data[0][0])) Nested list: [[2, 7, 8], [1, 5, 4]] Type of elements: Limitations of Nested Lists ... Read More

How to Create a Vector or Matrix in Python?

Vikram Chiluka
Updated on 26-Mar-2026 22:23:47

12K+ Views

In this article, we will show you how to create vectors and matrices in Python using NumPy, a powerful library for numerical computing. NumPy is a Python library designed to work efficiently with arrays. It is fast, simple to learn, and memory-efficient. NumPy allows us to create n-dimensional arrays for mathematical operations. What are Vectors? A vector is a 1-dimensional NumPy array containing components (ordinary numbers). You can think of a vector as a list of numbers where vector algebra operations are performed on these numbers. We use the np.array() method to create vectors. Syntax ... Read More

Advertisements