Plotly Articles

Page 3 of 4

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

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 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
Vani Nalliappan
Updated on 26-Mar-2026 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
Vani Nalliappan
Updated on 26-Mar-2026 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
Vani Nalliappan
Updated on 26-Mar-2026 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

How to save multiple plots into a single HTML file in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 4K+ Views

Plotly is an open-source Python library for creating interactive charts. You can use the plotly.subplots feature to save multiple plots into a single HTML file, which is useful for creating dashboards or comparing different visualizations. Using make_subplots to Create Multiple Plots The make_subplots function allows you to create a grid of subplots within a single figure. Here's how to create and save multiple plots to an HTML file − import plotly from plotly.subplots import make_subplots import plotly.graph_objects as go # Create subplots with 2 rows and 1 column fig = make_subplots(rows=2, cols=1, ...

Read More

How to highlight all the values from a group on hover in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 1K+ Views

Plotly enables you to group data points and highlight all values from a group when hovering over any point in that group. This is achieved using the groupby transform feature, which creates interactive visualizations with enhanced hover capabilities. Understanding Group Highlighting When you hover over any data point in a group, Plotly automatically highlights all related points in the same group. This feature uses the transforms property with groupby type to organize data into distinct visual groups. Step-by-Step Implementation Step 1: Import Required Module Import plotly.io for creating and displaying interactive plots − ...

Read More

How to change the size of a Dash Graph in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 3K+ Views

Dash is a Python framework for building interactive web applications with Plotly graphs. You can easily control the size of graphs in a Dash app by using the style parameter in dcc.Graph() component to set custom height and width dimensions. Basic Setup First, import the required libraries and create sample data ? import dash from dash import dcc, html import pandas as pd import plotly.express as px # Create sample data df_bar = pd.DataFrame({ "Season": ["Summer", "Winter", "Autumn", "Spring"], "Rating": [3, 2, 1, 4] }) # ...

Read More

How to set the range of Y-axis in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 30K+ Views

Plotly is a powerful Python library for creating interactive visualizations. One common requirement is controlling the Y-axis range to better display your data or focus on specific value ranges. Setting Y-axis Range with update_layout() The most straightforward way to set the Y-axis range is using the update_layout() method with the yaxis_range parameter − import plotly.graph_objs as go import numpy as np # Set random seed for reproducible results np.random.seed(3) # Generate X-axis data (0 to 18, step 2) x_values = list(range(0, 20, 2)) # Generate random Y-axis data y_values = np.random.randn(10) # ...

Read More

How to set the line color in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 17K+ Views

Python Plotly provides several methods to customize line colors in graphs. In this tutorial, we'll explore how to set line colors using plotly.express and the update_traces() method. Plotly Express contains many methods to customize charts and render them in HTML format. The update_traces() method with the line_color parameter is the primary way to set line colors after creating a plot. Basic Line Color Setting Here's a complete example showing how to create a line plot and set its color ? import plotly.express as px import pandas as pd # Create sample data data = ...

Read More

How to plot multiple figures as subplots in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 13K+ Views

Plotly is an open-source Python library for creating interactive charts. You can use the make_subplots feature available in Plotly to combine multiple figures into subplots within a single layout. In this tutorial, we will use plotly.graph_objects and plotly.subplots to create multiple subplots. The make_subplots() function allows you to specify the grid layout, while append_trace() adds individual plots to specific positions. Basic Subplot Creation Here's how to create a simple subplot layout with three scatter plots ? from plotly.subplots import make_subplots import plotly.graph_objects as go # Create subplot grid: 3 rows, 1 column fig = ...

Read More
Showing 21–30 of 31 articles
Advertisements