You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The traces in the bottom 2 subplot axes are assigned to axes (x2, y3) and (x3, y2). For clarity, this is how these assignments look in the JSON editor:
If I changes the axes assignments of these traces to the correct (x2, y2), (x3, y3), one of the subplots disappears - this is the bug. There seems to to be an issue with trace-axes assignment.
Maybe its just a bug in Python, but changing xaxis2/yaxis2 (1st subplot) + xaxis3/yaxis3 (2nd suplot) to xaxis/yaxis + xaxis2/yaxis2 as suggested doesn't seem to work, since the 1st subplot becomes blank once again...
Activity
etpinard commentedon Jan 18, 2017
Ok. Something is up when a layout has
xaxis2/yaxis2but noxaxisandyaxisHere's an more minimal reproducible example http://codepen.io/etpinard/pen/bggwQw
@jackparmer in the meantime, make
xaxis2->xaxisetc and things should work: http://codepen.io/etpinard/pen/PWWGZvjackluo commentedon Jan 18, 2017
Maybe its just a bug in Python, but changing xaxis2/yaxis2 (1st subplot) + xaxis3/yaxis3 (2nd suplot) to xaxis/yaxis + xaxis2/yaxis2 as suggested doesn't seem to work, since the 1st subplot becomes blank once again...
etpinard commentedon Jan 18, 2017
@thejackluo can you paste your
layoutobject?jackluo commentedon Jan 20, 2017
In[]:
Imports required libraries
from datetime import datetime
import numpy as np
import pandas as pd
import plotly.plotly as py
from plotly.graph_objs import *
from plotly.grid_objs import Grid, Column
mapbox_access_token = 'pk.eyJ1IjoiamFja2x1byIsImEiOiJjaXhzYTB0bHcwOHNoMnFtOWZ3YWdreDB3In0.pjROwb9_CEuyKPE-x0lRUw'
In[]:
Selects data
filename = "data/walmart_store_openings.csv"
chart_filename = "Walmart " + str(datetime.now())
df = pd.read_csv(filename, encoding = "utf-8-sig")
#df
#print(df.columns)
Gets list of years
years = [str(i) for i in range(1962,2007)]
Bug with Grid parsing if dataset isn't sanitized, need to return NaN instead of empty []
#years = df["YEAR"].unique()
#years = [str(i) for i in sorted(years)]
Groups by year and count number of stores
ylist = df.groupby("YEAR").count()["storenum"].astype(int)
ylist_cum = ylist.cumsum()
Gets max range for subplot (minimum set to 0, no y-axis jump)
max_range = max(ylist) * 1.15
max_range_cum = max(ylist_cum) * 1.15
Converts list items to string
ylist = [str(i) for i in ylist]
ylist_cum = [str(i) for i in ylist_cum]
In[]:
Uploads all 2 Grids
Since Grid has a size limit, it is good practice to upload
multiple Grids for suplots in case of large datasets
grid_filename = chart_filename + " Grid"
grid_filename2 = grid_filename + "2"
columns = []
columns2 = []
for i, year in enumerate(years):
Will throw error if file exists or path is not root
grid = Grid(columns)
py.grid_ops.upload(grid, grid_filename, auto_open=False)
grid2 = Grid(columns2)
py.grid_ops.upload(grid2, grid_filename2, auto_open=False)
In[]:
Creates data
Main trace
trace1 = Scattermapbox(
)
Non-cumulative secondary
trace2 = Scatter(
)
Cumulative secondary
trace3 = Scatter(
)
Note that subplots are mapped to opposite yaxis (temporary solution, bugfix impending)
In[]:
Sets up slider and buttons
slider = dict(
)
sliders = dict(
)
for year in years:
updatemenus = dict(
)
In[]:
Creates layout
layout = dict(
)
In[]:
Creates frames
frames = []
for i, year in enumerate(years):
In[]:
Uploads animation
data = [trace1, trace2, trace3]
figure = dict(data=data, layout=layout, frames=frames)
py.icreate_animations(figure, filename=chart_filename, auto_open=False)
etpinard commentedon Feb 2, 2018
This bug appears fixed:
gives (I believe) the desired result:
This was probably fixed in @alexcjohnson 's #2227 and/or #1854