We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When exporting a figure to svg, for rotation=90 text is always left-alignment, no matter how va and ha are actually set.
svg
rotation=90
va
ha
import matplotlib.pyplot as plt fig,ax = plt.subplots() for va in ['bottom','top']: for ha in ['left','right']: ax.annotate( f"{ha}+{va}", xy=(1,0.5), xycoords='data', va=va, ha=ha ) ax.annotate( f"{ha}+{va}", xy=(0.5,1.0), xycoords='data', rotation=90, va=va, ha=ha ) from matplotlib import rcParams rcParams['svg.fonttype'] = 'none' fig.savefig('figure.svg', format='svg')
(the code produces figure.svg which I cannot upload, because the type is not supported)
figure.svg
Here I open the .svg file in inkscape to illustrate the outcome:
.svg
This is the alignment that I intend to achieve, but which seems to be impossible to produce:
Ubuntu 20.04
3.3.2
Qt5Agg
3.8.6
No response
conda
conda-forge
The text was updated successfully, but these errors were encountered:
I think what you want is to set the Text rotation mode to 'anchor':
ax.annotate(f"{ha}+{va}", xy=(0.5, 1.0), xycoords='data', rotation=90, rotation_mode='anchor', va=va, ha=ha)
Sorry, something went wrong.
I think what you want is to set the Text rotation mode to 'anchor': ax.annotate(f"{ha}+{va}", xy=(0.5, 1.0), xycoords='data', rotation=90, rotation_mode='anchor', va=va, ha=ha)
You are right, rotation_mode='anchor' is what I need(ed). Thank you for pointing that out, and sorry for the noise!
rotation_mode='anchor'
No branches or pull requests
Bug summary
When exporting a figure to
svg
, forrotation=90
text is always left-alignment, no matter howva
andha
are actually set.Code for reproduction
Actual outcome
(the code produces
figure.svg
which I cannot upload, because the type is not supported)Here I open the
![observed](https://user-images.githubusercontent.com/12622691/127876793-e74f0b24-feca-427c-888e-0ba9ad6ff081.gif)
.svg
file in inkscape to illustrate the outcome:Expected outcome
This is the alignment that I intend to achieve, but which seems to be impossible to produce:
Operating system
Ubuntu 20.04
Matplotlib Version
3.3.2
Matplotlib Backend
Qt5Agg
Python version
3.8.6
Jupyter version
No response
Other libraries
No response
Installation
conda
Conda channel
conda-forge
The text was updated successfully, but these errors were encountered: