question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

x axis labeling disappears when using twinx()

See original GitHub issue

Code sample, a copy-pastable example if possible

A “Minimal, Complete and Verifiable Example” will make it much easier for maintainers to help you.

import proplot as plot
import numpy as np
import xarray as xr

times = np.arange(1990, 2000)
data = xr.DataArray(np.random.rand(len(times)), dims=['time'], coords=[times])

f, ax = plot.subplots(aspect=2)
ax.plot(data.time, data)

twinax = ax.twinx()

# twinax.format(xlocator=1)
ax.format(xticks=np.arange(1990, 2000, 2))

Actual result vs. expected result

Using twinx(), the tick labeling disappears on the twin axis. This happens for datetime and normal numbers. Using xticks/xlocator on the main axis or twinax instance changes the ticks but does not produce labels.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
lukelbdcommented, Mar 7, 2020

My bad! I see now, this definitely is a major problem. I will address this before the end of the weekend. Thanks for the additional examples.

1reaction
zxdawncommented, May 14, 2020

Works well. Thank Luke! proplot_profile

Read more comments on GitHub >

github_iconTop Results From Across the Web

x axis labeling disappears when using twinx() #127 - GitHub
Using twinx() , the tick labeling disappears on the twin axis. This happens for datetime and normal numbers. Using xticks / xlocator on...
Read more >
Twinx makes labels disappear - python - Stack Overflow
You will need to set the labels for X-axis using the set_xticklabels() to show the fields. Add this line after plotting the graph....
Read more >
matplotlib.axes.Axes.twinx — Matplotlib 3.6.2 documentation
The x-axis autoscale setting will be inherited from the original Axes. To ensure that the tick marks of both y-axes align, see LinearLocator...
Read more >
x-ticks disappear when plotting on subplots sharing x-axis ...
This happens when I try to plot a line and an area on the same subplot. I found the my x-ticks disappear after...
Read more >
Chart labels on y axis are missing - Microsoft Support
Chart labels on y axis are missing. Not all of them are displayed. Some of them are skipped. Sometimes even Expand Chart will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found