Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use log scale on polar axis in matplotlib
    primarykey
    data
    text
    <p>I am trying to create a polar plot with a log scale on the radial axis but I keep getting an error. Some example code and the error are below. It seems to work fine in Cartesian coordinates, does anyone know what's happening??</p> <pre><code>import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm bazbins = np.linspace(0, 2*np.pi, 360) fbins = np.logspace(np.log10(0.05), np.log10(0.5), 101) theta, r = np.meshgrid(bazbins, fbins) # Set up plot window fig, ax = plt.subplots(figsize=(12,9))#, subplot_kw=dict(projection='polar')) # polar ax.set_theta_zero_location('N') ax.set_theta_direction(-1) ax.set_rscale('log') # carthesia #ax.set_yscale('log') # Plot data #ax.pcolormesh(theta, r, r) plt.gca().invert_yaxis() ax.contourf(theta, r, r) ax.set_ylim((0.0, 0.5)) plt.show() </code></pre> <p>Exception in Tkinter callback:</p> <pre><code>Traceback (most recent call last): File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__ return self.func(*args) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 236, in resize self.show() File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 239, in draw FigureCanvasAgg.draw(self) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 421, in draw self.figure.draw(self.renderer) File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 898, in draw func(*args) File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 1997, in draw a.draw(renderer) File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1045, in draw tick.draw(renderer) File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 239, in draw self.label1.draw(renderer) File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/text.py", line 591, in draw ismath=ismath) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 156, in draw_text return self.draw_mathtext(gc, x, y, s, prop, angle) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 145, in draw_mathtext x = int(x) + ox ValueError: cannot convert float NaN to integer </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload