Skip to content
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

Mode modified 4.1.0 #1

Open
wants to merge 7 commits into
base: release_4.1.0
Choose a base branch
from
Open

Conversation

curt-mitch
Copy link

Resolves: https://github.com/mode/issues/issues/663

This PR consists of modifications to Plotly release v4.1.0 for use in Mode's own Python notebook environment. The general workflow was to mimic changes made to the 3.2.1 release for use in Mode's notebooks (master...mode-plotly-3.2.1-layed#diff-3465b0f2dbd6f036db2c0713d3f40872R112).

We created a mock report with the following SQL query:

SELECT quarter, touchdowns
FROM (
  SELECT 'spring' as quarter, 14138 as touchdowns
  UNION ALL
  SELECT 'summer', 22157
  UNION ALL
  SELECT 'fall', 15727
  UNION ALL
  SELECT 'winter', 21092
)

And tested it in a Python notebook with this:

from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
from plotly.graph_objs import *
import plotly
plotly.offline.init_notebook_mode()
import pandas as pd

df = datasets[0]

trace1 = Bar(
    x=df.QUARTER,
    y=df.TOUCHDOWNS,
    name='Touchdowns'
)

data = [trace1]
layout = Layout(
    title='Touchdowns by Quarter',
    margin=dict(b=200,l=80,r=150,t=55),
    width= 1000,
    height= 330, 
    bargap = 0.1,
    xaxis=dict(
      tickangle=-45,
      title='Test'
    ),
    yaxis=dict(
        title='Touchdowns'
    ), 
)

fig = dict(data=data, layout=layout)
iplot(fig)

This example code was based on this report: https://app.mode.com/editor/modeanalytics/reports/834ec095fc72/notebook

Screenshot 2019-11-13 14 57 27

Copy link

@mstockm mstockm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! One question which @laughinghan and I had earlier which we should figure out, is if we want to add some code to set the default theme to match the older version (in the screenshot it appears to have the new default theme). This would mean not changing the visual appearance of existing charts. Also I can help out with testing a build of this using a non-hotloaded installation if you haven't done that already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants