Plotly Articles

Page 2 of 4

How to plot on secondary Y-Axis with Python Plotly?

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

Plotly is an open-source, interactive, and browser-based charting library for Python. Python users can use Plotly to generate different types of charts including scientific charts, 3D graphs, statistical charts, financial charts, etc. In this tutorial, we will show how you can use Plotly to plot data on the secondary Y-Axis. Here we will use the plotly.graph_objects module to generate figures. It contains a lot of methods to customize the charts and render them into HTML format. We will plot two bar charts using the add_trace() method and then use the update_layout() method to set a property with dict arguments. ...

Read More

How to add multiple text labels from DataFrame columns in Python Plotly?

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

Plotly is a powerful Python library for creating interactive visualizations. You can add multiple text labels from DataFrame columns to enhance your charts with additional information that appears on hover or as annotations. In this tutorial, we'll learn how to create a scatter plot with text labels from different DataFrame columns using Plotly's graph_objects module. Required Libraries We'll use the following Python libraries ? plotly.graph_objects − For creating interactive plots pandas − For DataFrame operations plotly.offline − For generating HTML output Creating the DataFrame First, let's create a sample DataFrame with student ...

Read More

How to add multiple graphs to a Plotly Dash app on a single browser page in Python Plotly?

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

Plotly Dash is a Python framework for building interactive web applications. You can add multiple graphs to a single Dash app by organizing them within HTML Div components and using dcc.Graph elements. Setting Up Multiple Graphs To create multiple graphs on one page, you need to structure your layout with separate html.Div containers for each graph ? import dash from dash import dcc, html import pandas as pd import plotly.express as px # Initialize the Dash app app = dash.Dash(__name__) # Create sample data df_seasons = pd.DataFrame({ "Season": ["Summer", "Winter", ...

Read More

Python Plotly – How to hide legend entries in a Plotly figure?

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

Plotly is a powerful open-source plotting library in Python that creates interactive web-based visualizations. Sometimes you may want to hide specific legend entries to reduce clutter or highlight only certain data series in your plots. In this tutorial, we will demonstrate different methods to hide legend entries in Plotly figures using the showlegend parameter. Method 1: Using showlegend Parameter The most direct way to hide legend entries is by setting showlegend=False when creating traces ? import plotly.graph_objects as go import plotly.offline as py # Create sample data x = [1, 2, 3, 4, 5] ...

Read More

How to shade a chart above a specific Y value in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 653 Views

Plotly is a powerful plotting library in Python that enables you to create interactive visualizations. Sometimes you need to highlight specific regions of your chart by shading areas above or below certain Y values to emphasize important thresholds or ranges. In this tutorial, we will show how to shade a chart above a specific Y value using Plotly's add_hrect() method. Understanding the Methods To shade chart areas, we use these key Plotly methods: add_hrect() − Adds a horizontal rectangle to shade regions based on Y-axis values add_vline() − Adds vertical reference lines plotly.express − Creates ...

Read More

Python Plotly – How to change variable/label names for the legend in a line chart?

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

Plotly is an open-source, interactive, and browser-based charting library for Python. Python users can use Plotly to generate different types of charts including scientific charts, 3D graphs, statistical charts, financial charts, etc. In this tutorial, we will show how you can use Plotly to change the variable and label names for the legend in a line chart. The name parameter in scatter traces controls legend labels, while legend_title customizes the legend title. Basic Setup First, import the required module and create a figure object ? import plotly.graph_objs as go # Create a figure object ...

Read More

How to plot multiple lines on the same Y-axis in Python Plotly?

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

Plotly is an open-source plotting library in Python that creates interactive web-based visualizations. In this tutorial, we will show how to plot multiple lines on the same Y-axis using plotly.express and pandas. When working with time-series data or comparing multiple metrics, plotting multiple lines on the same chart helps visualize trends and relationships between different datasets. Method 1: Using add_scatter() First, create a line plot and then add another line using add_scatter() method ? import plotly.express as px import pandas as pd # Create dataset data = { 'year': [2015, ...

Read More

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

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 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
Vani Nalliappan
Updated on 26-Mar-2026 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
Vani Nalliappan
Updated on 26-Mar-2026 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
Showing 11–20 of 31 articles
Advertisements