Multiple Traces
Plotly lets you make awesome charts with multiple traces. You can mix and match diverse types of traces to create combo charts or use the same type of traces to create stack or group charts.
There's no limit to what you can do with Plotly and multiple traces.
Combo Charts
When a chart uses more than one type of trace for visualization, it is a combo chart. Like combining column and line graphs in one chart.
Plotly could combine all types of traces with each other and make combo chart. Even if the traces nature is not match, Plotly will draw the result for you.
Multiple Traces Options
When similar traces are used to make a chart, you can determine their position relative to each other. The default mode changes according to the chart type.
This feature is used for cartesian charts (with x and y axis) and cannot be used in some charts such as pie, polar and map.
Mode
These modes offer versatile ways to visualize and interpret multiple traces in a single chart, each providing unique insights depending on the comparison or relationship you are exploring.
Group for side-by-side comparison, Stack for cumulative views, Relative for proportions, and Overlay for combined analysis across various chart types.
In Group mode, each trace is represented separately but aligned side-by-side for each category or segment. This mode is not limited to bars; it can be used with lines, points, or other chart types.
Use Case
Ideal for direct comparison of different traces within the same category. It helps in analyzing how each trace performs in relation to others within the same segment.
Example
Imagine comparing the sales of three products (A, B, C) across four quarters. Each quarter will have three bars (one for each product) grouped together
In Stack mode, values from different traces are piled on top of one another for each category. This can be visualized with bars, areas in an area chart, or even segments in a funnel chart.
Use Case
Useful for understanding the total cumulative effect of all traces in each category while also observing the individual contribution of each trace.
Example
Continuing the example above, the sales of products A, B, and C in each quarter are stacked on top of each other. This shows the total sales per quarter and the contribution of each product to that total.
Like Stack mode but displays the proportional contribution of each trace as a percentage of the total for each category.
Use Case
Best for comparing the relative size or importance of each trace within a total, especially when the absolute values are less important than the proportion.
Example
In our sales example, each product's sales are shown as a percentage of the total sales per quarter. This way, you can easily compare the market share of each product per quarter.
In Overlay mode, different traces are plotted in the same space without stacking, often using unique styles (like combining a line chart and a bar chart) or transparencies.
Use Case
Ideal for comparing multiple traces that may have different scales or units. It provides a clear view of how different traces relate to each other within the same context.
Example
You could overlay a line graph showing customer satisfaction scores on top of the bar graph of sales. This allows for a comparison of sales figures with customer satisfaction trends.
Gap and Group Gap
These options are used to describe the spacing between elements in a chart, specifically when dealing with multiple traces like bars in a bar chart.
Refers to the space between separate groups of bars or elements in a chart. In charts with multiple traces, this setting controls how much space is left between these groups.
Controls the space between individual bars or data points within a single category or location coordinate. It's a way to adjust how tightly or loosely the bars or elements are packed together.
Normalization
Fraction normalization is useful when you want to understand the relative size of each data point in relation to a total. It's often used in scenarios where the absolute values are less important than the proportion they represent of the whole.
This is like fraction normalization but scales the data points to sum up to 100%. Each data point is represented as a percentage of the total.
Last updated
Was this helpful?