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

xticks rotation being is ignored #449

Open
pranet opened this issue Mar 16, 2018 · 9 comments
Open

xticks rotation being is ignored #449

pranet opened this issue Mar 16, 2018 · 9 comments
Labels

Comments

@pranet
Copy link

pranet commented Mar 16, 2018

I am trying to rotate the labels on the x axis by using plt.xticks(positions, labels, rotation=90). While it is working fine using plt.show(), mpld3.show() is completely ignoring the rotation parameter and displaying text horizontally (0 rotation) instead.

Can someone suggest a workaround please?

@azayz
Copy link

azayz commented Jul 1, 2020

Yes please I'm also struggling with this, the title doesn't appear aswell
Capture

@cliffckerr
Copy link
Member

Good question @azayz @pranet -- we'll take a look!

@vladh
Copy link
Member

vladh commented Jul 9, 2020

I'm working on this and I'll update you as soon as it's fixed! Sorry for the delay, trying to make time. :)

@vladh vladh added bug and removed enhancement labels Jul 31, 2020
@vladh
Copy link
Member

vladh commented Jul 31, 2020

@azayz I'm currently testing this, is there any chance you could share your code, so I can confirm I'm actually fixing it for your use case? Somehow I'm experiencing even more bugs than you did.

Also, related issues: #369 #22 #221 #360 #364

Edit 1: Additional matplotlib==3.3.0 bug being tracked in #471.

@vladh
Copy link
Member

vladh commented Jul 31, 2020

I've looked at this in more detail, and have reached the conclusion that tick rotation seems to be a feature that was never implemented, and probably needs to be implemented in both mplexporter and mpld3.js, as I don't think the rotation information is currently passed from MPL to D3. The rotation information should be extracted in mplexporter/mplexporter/utils.py and added to the D3 graph in src/core/axis.js. I'll do my best to make time to implement this, which should go more quickly now that I've identified the issue, but right now tick rotation is not something that mpld3 supports. I'll try to add it soon! :)

@munna
Copy link

munna commented Nov 4, 2020

As per me, a simple and easy solution to rotate xAxis is CSS.

css = """ .mpld3-xaxis text{ transform: translate(18px, 30px) rotate(45deg); } """

Apply this CSS to plugins connect
mpld3.plugins.connect(fig, mpld3.plugins.PointHTMLTooltip(lines[0],labels=labels,voffset=10, hoffset=10,css=css))

It works for me like charm.

@asilvino
Copy link

asilvino commented Oct 7, 2022

Do we have any update on this matter?

@vladh
Copy link
Member

vladh commented Oct 7, 2022

I won't have the time to fix this myself anytime soon, but I would gladly review a PR and I encourage those who this affects to send one!

@JosePereiraUA
Copy link

Hi.
I too would like an update on this issue.
+1 if someone could take a look.
Cheers!

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

No branches or pull requests

8 participants