How to Change a Plotly Express Icicle Chart Orientation from Horizontal to Vertical

What will you learn?

In this tutorial, you will learn how to alter the orientation of a Plotly Express Icicle chart from horizontal (right to left) to vertical (top down). This adjustment allows for a more effective visualization of hierarchical data in a top-down manner.

Introduction to the Problem and Solution

Plotly Express Icicle charts are powerful tools for visualizing hierarchical data. However, there are instances where changing the orientation of the chart becomes necessary. By transitioning from a horizontal layout to a vertical one, we can enhance the clarity and understanding of our data structure. This guide aims to demonstrate an efficient method to achieve this transformation seamlessly.


# Import necessary library
import as px

# Create an example icicle chart with horizontal orientation
fig = px.icicle(names=["A", "B", "C", "D"], parents=["", "", "A", "B"], values=[10, 20, 15, 5])

# Change the orientation of the icicle chart from horizontal to vertical
fig.update_traces(textinfo='label+percent parent')

# Copyright PHD

Note: The provided code snippet generates an example icicle chart using Plotly Express and modifies its orientation from horizontal (right-to-left) to vertical (top-down).


To change the orientation of a Plotly Express Icicle chart: 1. Initially create an icicle chart with horizontal orientation using px.icicle(). 2. To switch its orientation vertically, utilize the update_traces() method while setting the textinfo parameter as ‘label+percent parent’.

This process ensures that our icicle chart is displayed in a top-down layout instead of right-to-left.

  1. How do I install Plotly library in Python?

  2. To install the Plotly library in Python, simply use pip by executing pip install plotly.

  3. Can I customize colors on my Plotly charts?

  4. Yes, you can customize colors on your plots by specifying color-related attributes within your code or utilizing built-in color scales provided by Plotly.

  5. Is it possible to add animations to my Plotly charts?

  6. Certainly! You can incorporate animations into your charts using functions like update combined with frames for dynamic visualizations.

  7. How do I save my interactive Plotly charts as static images?

  8. You can save your interactive plots as static images by invoking .write_image(“filename.png”) on your figure object.

  9. Can multiple traces be combined into one legend entry on a express bar graph?

  10. Yes, multiple traces can be merged into one legend entry by assigning the same name attribute for those traces during creation.


In conclusion, mastering the manipulation of properties and configurations in various types of charts enables us to effectively convey our data visually. With this newfound knowledge on altering orientations in an icicle chart using Ploty, you are now better equipped when working with hierarchical representations efficiently.

Leave a Comment