Skip to content

X-axis title appears above graph when using showticklabels=False #4295

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

Closed
Coding-with-Adam opened this issue Jul 24, 2023 · 1 comment
Closed

Comments

@Coding-with-Adam
Copy link
Contributor

This issue was reported by a community member in this post.
It appears that this bug is tied to certain Plotly versions ("If I upgrade plotly to 5.14.0 and stay with dash 2.7.1 the x-axis title is on top")

import numpy as np
import plotly.express as px

x_values = np.linspace(0, 100, 10)
y_values = np.linspace(0, 100, 10)

fig = px.line(x=x_values, y=y_values, labels={"x": "X-axis label", "y": "Y-axix label"})

fig.update_xaxes(
    showline=True,
    linecolor="black",
    mirror=True,
    range=[x_values.min(), x_values.max()],
    fixedrange=True,
    showticklabels=False,
)
fig.update_yaxes(
    showline=True,
    linecolor="black",
    mirror=True,
    range=[0, 100],
    fixedrange=True,
)
fig.show()

image

Update the x_axes to showticklabels=True, and the problem disappears.

@alexcjohnson
Copy link
Collaborator

Duplicate of plotly/plotly.js#6552

@alexcjohnson alexcjohnson marked this as a duplicate of plotly/plotly.js#6552 Jul 24, 2023
@alexcjohnson alexcjohnson closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2023
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

No branches or pull requests

2 participants