Python Forum
Sort y axis by descening values matplotlib
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort y axis by descening values matplotlib
#1
See below code, the problem with this logic is that I want the y axis to be in a descending format where a league position of 1 is higher that 5.

How can I set it up that the y axis is descending?
import matplotlib.pyplot as xyz
year = [2016,2017,2018]

leaguepos = [1,10,5]

points = [90,50,70]

xyz.bar(points,leaguepos,
label=year,width=.5)
xyz.legend()
xyz.xlabel('Points')
xyz.ylabel('League Position')
xyz.title('League Performance')
xyz.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  matplotlib x-axis text move bottom upward jacklee26 3 978 May-31-2023, 04:28 AM
Last Post: jacklee26
  Print names in x-axis of a time-series values hobbyist 4 1,218 Apr-22-2023, 09:29 PM
Last Post: deanhystad
  Getting proper x,y axis values pyhill00 8 1,636 Jul-29-2022, 06:48 PM
Last Post: pyhill00
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,116 May-17-2022, 11:38 AM
Last Post: Larz60+
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,312 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  x-axis labels with Matplotlib Mark17 8 2,195 Mar-23-2022, 06:10 PM
Last Post: Mark17
  How to make x-axis readable with matplotlib Mark17 7 3,910 Mar-01-2022, 04:30 PM
Last Post: DPaul
  matplotlib x axis range goes over the set range Pedroski55 5 3,185 Nov-21-2021, 08:40 AM
Last Post: paul18fr
  Sample labels from excel file in order to put them on x-axis and y-axis of a plot hobbyist 11 4,324 Sep-14-2021, 08:29 AM
Last Post: hobbyist
  How to sort values descending from a row in a dataframe using python sankarachari 1 1,418 Aug-16-2021, 08:55 AM
Last Post: jamesaarr

Forum Jump:

User Panel Messages

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