FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Horizontal and vertical text alignment not working on set_rgrids() · Issue #10105 · matplotlib/matplotlib · GitHub

Repository navigation

Horizontal and vertical text alignment not working on set_rgrids() #10105

Closed

Description

Bug report

Bug summary

Horizontalalignment and verticalalignment text properties for set_rgrids() do not work. Have tried other text properties, such as style and color, and they do work.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

variables = ("var1","var2","var3","var4")
data = (5,10,100,1.25)
ranges = [(0,5),(5,15),(50,110),(2,1)]

angles = np.arange(0, 360, 360./len(variables))
angles0 = np.deg2rad(np.r_[angles, angles[0]])

n_ordinate_levels=6

fig1 = plt.figure(figsize=(6,6))

rectangle = [0.1,0.1,0.8,0.8]

ax1 = fig1.add_axes(rectangle,polar=True,label='ax1')
ax2 = fig1.add_axes(rectangle,polar=True,label='ax2')
ax3 = fig1.add_axes(rectangle,polar=True,label='ax3')
ax4 = fig1.add_axes(rectangle,polar=True,label='ax4')

ax00 = [ax1,ax2,ax3,ax4]


l, text = ax1.set_thetagrids(angles,labels=variables)
for j in range(len(ax00)-1):
            ax00[j+1].patch.set_visible(False)
            ax00[j+1].grid("off")
            ax00[j+1].xaxis.set_visible(False)
 
    
for i in range(len(ax00)):
    grid = np.linspace(*ranges[i], 
                       num=n_ordinate_levels)
    gridlabel = ["{}".format(round(x,2)) 
                 for x in grid]
    grid0 = [0,0.2,0.4,0.6,0.8,1]
    gridlabel[0] = "" # clean up origin
    ax00[i].set_rgrids(grid0, labels=gridlabel,
                 angle=angles[i], horizontalalignment = 'center',
                 verticalalignment = 'center')
    ax00[i].spines["polar"].set_visible(False)
    ax00[i].set_ylim(bottom=0,top=1)

Actual outcome

No text alignment

Expected outcome

Radial axe labels to be aligned centrally, both vertically and horizontally

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6.3
  • Jupyter version (if applicable):
  • Other libraries:

Matplotlib/Python downloaded with Anaconda

Activity

  1. pbregener commented on Feb 19, 2018

    This unfortunately appears to be a regression in v2.1.0. The alignment works fine in v2.0.2. I guess it is related to the massive changes from #4699? Thoughts @QuLogic?

    Edit: Might also be related to the follow-up PRs #9068 and #9881

    Does anyone have a workaround?

  2. pbregener commented on Feb 26, 2018

    Can you confirm this @QuLogic? Would love to see this fixed (and help doing so, if I can) in the near future, as I've seen cases where the radius labels were misleading due to wrong horizontal and vertical alignment (they may appear to be offset by one tick).

  3. pbregener commented on Feb 28, 2018

    cc @tacaswell for regression triaging/scheduling

  4. pbregener commented on May 22, 2018

    PR #10792 should have closed this

  5. jklymak commented on May 22, 2018

    Member

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL