✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Y Axis out of order and data jumping around when plotting multiple traces on the same plot

I have a really odd behavior I’m seeing with plotly. I have a decently large data set that I’m trying to graph. The dataset is a JSON I query and then loop through and add to an array:

for (var i = 0; i < (data.length); i++) {

The array is then fed into:

		var trace_temp2 = {
		  x: x_arr,
		  y: temp2,
		  mode: 'lines',
		  name: 'temp2'

var dataTemperatures = [ trace_temp1 , trace_temp2 , trace_temp3 , …]

var layout = {};

Plotly.newPlot(‘myDivTemperature’, dataTemperatures, layout);

The results look like the following zommed in:

As you can see the Y axis is out of order for random values and my trace_temp2 jumps up on the y axis to a smaller number. I thought it might be the datetime timestamp, but I’m pretty sure is isn’t. In fact if I plot this trace_temp2 alone it plots perfectly!

Any ideas why it plots perfectly alone, but not with other traces on the same plot?

Edit: One thing I noticed is this behavior occurs for a certain range of values:

I think I figured it out. I was using the same layout for each of the data traces:

var layout = {};

Need to create separate layouts for each graph. :smile:

Hope that helps someone in the future!