-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mixed up axes assignments in subplots #1312
Comments
Ok. Something is up when a layout has Here's an more minimal reproducible example http://codepen.io/etpinard/pen/bggwQw @jackparmer in the meantime, make |
@thejackluo can you paste your |
In[]:Imports required librariesfrom datetime import datetime import plotly.plotly as py mapbox_access_token = 'pk.eyJ1IjoiamFja2x1byIsImEiOiJjaXhzYTB0bHcwOHNoMnFtOWZ3YWdreDB3In0.pjROwb9_CEuyKPE-x0lRUw' In[]:Selects datafilename = "data/walmart_store_openings.csv" df = pd.read_csv(filename, encoding = "utf-8-sig") #df Gets list of yearsyears = [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() Groups by year and count number of storesylist = df.groupby("YEAR").count()["storenum"].astype(int) Gets max range for subplot (minimum set to 0, no y-axis jump)max_range = max(ylist) * 1.15 Converts list items to stringylist = [str(i) for i in ylist] In[]:Uploads all 2 GridsSince Grid has a size limit, it is good practice to uploadmultiple Grids for suplots in case of large datasetsgrid_filename = chart_filename + " Grid" columns = [] for i, year in enumerate(years):
Will throw error if file exists or path is not rootgrid = Grid(columns) grid2 = Grid(columns2) In[]:Creates dataMain tracetrace1 = Scattermapbox(
) Non-cumulative secondarytrace2 = Scatter(
) Cumulative secondarytrace3 = Scatter(
) Note that subplots are mapped to opposite yaxis (temporary solution, bugfix impending)In[]:Sets up slider and buttonsslider = dict(
) sliders = dict(
) for year in years:
updatemenus = dict(
) In[]:Creates layoutlayout = dict(
) In[]:Creates framesframes = [] for i, year in enumerate(years):
In[]:Uploads animationdata = [trace1, trace2, trace3] |
This bug appears fixed: Plotly.d3.json('https://plot.ly/~jackp/17340.json', (err, fig) => {
fig.data[1].xaxis = 'x2';
fig.data[1].yaxis = 'y2';
fig.data[2].xaxis = 'x3';
fig.data[2].yaxis = 'y3';
Plotly.newPlot(gd, fig.data, fig.layout);
}); gives (I believe) the desired result: This was probably fixed in @alexcjohnson 's #2227 and/or #1854 |
https://plot.ly/~jackp/17340/
The
trace
s 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.
The text was updated successfully, but these errors were encountered: