-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Secondary y-axis subplot support #1564
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
Conversation
|
To try out this PR: |
|
Hi @jonmmease , I am getting an exception using this feature (I installed as per instruction above in my Conda environment running Python 3.7): print(plotly.__version__)
fig = tools.make_subplots(
rows=2,
cols=2,
print_grid=False,
specs=[
[{'secondary_y': True}, {'secondary_y': True}],
[{'secondary_y': True}, {'secondary_y': True}]
]
)Outputs Looks like these lines in # Default spec key-values
SPEC_defaults = dict(
is_3d=False,
colspan=1,
rowspan=1,
l=0.0,
r=0.0,
b=0.0,
t=0.0
# TODO add support for 'w' and 'h'
)
_check_keys_and_fill('specs', specs, SPEC_defaults)Changing the above with a default works around the error. # Default spec key-values
SPEC_defaults = dict(
is_3d=False,
colspan=1,
rowspan=1,
l=0.0,
r=0.0,
b=0.0,
t=0.0,
secondary_y=False
# TODO add support for 'w' and 'h'
)
_check_keys_and_fill('specs', specs, SPEC_defaults)However, it seems that my Did I do something wrong in the installation process? I also tried |
|
Hi @marcotama, thanks for giving it a try. Do you have the Thanks! |
|
Hi @jonmmease , I feel a little stupid! I was missing that import line. |
|
Hi @marcotama, great! Thanks for giving it a try. The current stable version is 3.9.0 so this will go into 3.10.0. And yes, prior to version 4.0 you'll need this |
Overview
This PR introduces secondary
y-axissupport to thesubplots.make_subplotsand associated functions. This functionality is only available in thev4_subplotsfuture mode.make_subplots update
The
subplots.make_subplotsfunction not supports asecondary_ykey in the elements of thespecsargument. The figure methods for adding traces now also support asecondary_yargument.For example:
get_subplot
Update traces
Update yaxis
cc @nicolaskruchten @chriddyp