2

I'm using python 2.7.14 with matplotlib 2.1.1 on Debian buster. I want to create a polar plot with an inverted radial axis. My values on radial axis are mostly negative and I want lower values ploted at higher radius, as they represent a better outcome, and vice versa. Additionally I want to set the coordinate origin to a defined value. However matplotlib seems to cause problems by defining the limits with the second parameter undergoing the first one. There exist some solutions (maybe a bit outdated) to this problems here and here. But is there an more elegant way to invert the axis? My code looks like this:

#!/usr/bin/env python
# -*- coding: utf-8 -*- 

import matplotlib.pyplot as plt
import numpy as np

angle = [-90.,-45.,-30.,-20.,-13.,-9.,-6.,-4.,-2.,-1.,0.,1.,2.,4.,6.,9.,13.,20.,30.,45.,90.]
tresh = [-16.1,-16.,-13.8,-12.4,-10.7,-9.4,-8.,-6.7,-6.,-6.5,-6.4,-6.7,-6.5,-7.4,-7.6,-10.1,-12.4,-14.3,-15.5,-16.9,-17.4]

arc = np.deg2rad(angle)

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
ax.plot(arc,tresh)

ax.set_thetamin(-90)
ax.set_thetamax(90)
ax.set_theta_zero_location('N', offset=0)
ax.set_theta_direction(-1)

#ax.set_rorigin(-2)#This origin I want to set optionally.
ax.set_ylim(-18,-5)

#plt.show()
fig.savefig('test.png')

The following picture explains want I want to do. enter image description here

Thank you for your help.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Lukas
  • 73
  • 1
  • 10
  • 2
    Possible duplicate of [Reverse radial axes of Matplotlib polar plot](https://stackoverflow.com/questions/43082637/reverse-radial-axes-of-matplotlib-polar-plot) – OriolAbril Jun 14 '18 at 21:32

0 Answers0