plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

No bar transition when uniformtext is used

Open emmanuelle opened this issue 5 years ago • 5 comments

See https://codepen.io/emmanuelle-plotly/pen/ExVWBdV : there is no transition, but if you remove the uniformtext parameters the transition works again. The corresponding Python code is

df = dict(val=[1, 4, 4, 3], x=['a', 'b', 'a', 'b'], frame=[1, 1, 2, 2])
fig = px.bar(df, x='x', y='val', animation_frame='frame', text='val')
# Comment the line below for transition to work again
fig.update_layout(uniformtext_minsize=20, uniformtext_mode='hide')
fig.update_traces(texttemplate='%{text}', textposition='inside')

fig.show()

This problem was first noticed on the forum https://community.plotly.com/t/bar-chart-animation-transition-breaks-when-uniformtext-in-layout/38394

emmanuelle avatar Apr 25 '20 15:04 emmanuelle

There is no easy fix for this until we could revise transition code. So at the moment, this is the expected behaviour for bar-like traces as well as treemap & sunburst. BTW I will tag this as a bug & documentation.

archmoj avatar Apr 25 '20 23:04 archmoj

Curious whether there are any updates on this issue

ndrezn avatar Dec 08 '20 16:12 ndrezn

Can confirm same behaviour applies for Treemaps

marnunez avatar Nov 09 '22 15:11 marnunez

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

gvwilson avatar Jul 04 '24 12:07 gvwilson

@gvwilson This issue is still happening on 3.0.1 js code on the sunburst chart.

Sample js code:

var data = [{
	type: "sunburst",
	labels: ["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
	parents: ["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
	values:  [10, 14, 12, 10, 2, 6, 6, 4, 4],
	outsidetextfont: {size: 20, color: "#377eb8"},
	leaf: {opacity: 0.4},
	marker: {line: {width: 2}},
}];

var layout = {
	margin: {l: 0, r: 0, b: 0, t: 0},
	width: 500,
	height: 500,
	uniformtext: {
		mode: 'hide', /* if commented out, transitions work; when not commented out, transitions do not work */
		minsize: 10
	},
};
var config = {
	displayModeBar : false,
	displaylogo : false,
	responsive : false
};

Plotly.newPlot('myDiv', data, layout, config);

lucyh avatar Jun 11 '25 16:06 lucyh