Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Combined Bar and Scatter chart

Hello,

I seem to be running into an issue with Plotly in offline mode. For some reason, I cannot get my trace3 and trace 4 (which are lines) to show up on my html page.

from plotly.offline import plot
from plotly.graph_objs import *

trace1 = Bar(
x=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’,
‘Nov’, ‘Dec’, ‘Jan’],
y=[77.2691, 333.9577, 461.9127, 453.0488, 645.4461, 737.1871, 288.1582, 222.6391, 80.5548, 16.9028, 16.9028, 4.4045, 0.0000],

name='Current Data Forecast'

)
trace2 = Bar(
x=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’,
‘Nov’, ‘Dec’, ‘Jan’],
y=[0.0000, 0.8657, 56.1220, 122.0692 ,135.7967, 359.9837, 710.8131, 708.9107, 692.7660, 602.6456, 591.6644, 591.6644, 299.4880],

name='Potential Data Forecast'

)

trace3 = Scatter(
x=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’,
‘Nov’, ‘Dec’, ‘Jan’],
y=[372.89, 436.55, 503.86, 516.52, 627.55],
mode=‘lines’,
name=‘Actualized Data’
)

trace4 = Scatter(
x=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’,
‘Nov’, ‘Dec’, ‘Jan’],
y=[372.89, 436.55, 503.86, 516.52, 627.55],
mode=‘lines’,
name=‘Current Isilon Capacity’
)

data = [trace1, trace2, trace3, trace4]
layout = Layout(
xaxis=dict(
# set x-axis’ labels direction at 45 degree angle
tickangle=-45,
),
barmode=‘stack’
)
fig = Figure(data=data, layout=layout)
plot( fig )

Your trace3 and trace4 have identical lists for y, only the name is different, hence you should see only one line. I run offline your code (with Plotly 1.9.10) and the plot displays the common line for traces 3 and 4, and moreover at hovering the mouse over the line both names are displayed.