Python Forum
matplotlib barh y tick alignment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
matplotlib barh y tick alignment
#3
Yes I found that, but it covers the x axis which is fine, not the y axis which is causing the problem, the tick marks line up to the top of the bar, not the middle of it and looks a bit strange.

Ok, I've found solved this/found workaround for this. It's not the most intuitive, but I reset the xticks to [0,1] instead of [0,2] with the view that having the tick labels below the bar on a horizontal chart would look better, and then the align parameter worked:
    ax2.barh(xhar, yhar, align='center', color=['grey', rag_sets])         # align parameter now works
    ax2.set_xlabel('Number of Sets')
    ax2.set_xlim(0, 50)
    ax2.set_yticks([0, 1])                                                                     # so long as the ticks are set in this way
    ax2.set_yticklabels(tyreStock)
iFunk
Reply


Messages In This Thread
matplotlib barh y tick alignment - by iFunKtion - Oct-06-2016, 10:53 AM
RE: matplotlib barh y tick alignment - by Larz60+ - Oct-06-2016, 11:27 AM
RE: matplotlib barh y tick alignment - by iFunKtion - Oct-06-2016, 11:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python code for alignment and font size 1418 0 429 Jan-14-2024, 03:56 AM
Last Post: 1418
  make all text in Right to left alignment in tkinter widgets jalal0034 1 1,535 Sep-27-2022, 06:42 PM
Last Post: Larz60+
  Right to left alignment in python report using Reportlab jalal0034 1 2,010 Sep-27-2022, 04:25 AM
Last Post: jalal0034
  Points not plotting with reference to x-tick labels Mark17 2 1,376 Jun-14-2022, 05:38 PM
Last Post: Mark17
  How to get evenly-spaced datetime tick labels regardless of x-values of data points? Mark17 4 5,584 Apr-04-2022, 07:10 PM
Last Post: Mark17
  Floor division problem with plotting x-axis tick labels Mark17 5 2,312 Apr-03-2022, 01:48 PM
Last Post: Mark17
  pandas, tabulate, and alignment menator01 3 7,729 Feb-05-2022, 07:04 AM
Last Post: menator01
  Space between list and column alignment rturus 8 5,400 Mar-17-2021, 04:47 PM
Last Post: rturus
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,402 Mar-11-2021, 10:52 AM
Last Post: buran
  Only show every nth tick in chart tgottsc1 1 4,846 Feb-01-2021, 04:30 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020