File:Mpl example polar plot.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 540 × 540 pixels, file size: 40 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Logarithmic spiral with matplotlib
Date
Source Own work
Author Adrien F. Vincent

Rationale: this work aims at providing an up-to-date version of the previous work https://commons.wikimedia.org/wiki/File:Logarithmic_Spiral_Pylab.svg , done by Morn the Gorn.

The matplotlib (mpl) version is 1.5.3, with Python 2.7 and numpy 1.10

##########
## Code for the figure
##########
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import NullFormatter  # empty strings as tick labels

# Set up a figure with a polar projection
fig = plt.figure(figsize=(6, 6))
fig.clf()
ax = fig.add_subplot(1, 1, 1, polar=True)

# Plot a logarithmic spiral
t = np.arange(-4 * np.pi, 4 * np.pi, 0.1)
ax.plot(t, 1.19**t, linewidth=2)  #  one could also use `plt.polar`

# One wants a grid but without any tick label
ax.xaxis.set_major_formatter(NullFormatter())
ax.yaxis.set_major_formatter(NullFormatter())
ax.grid(True, ls='solid', color='0.75')

fig.savefig('logarithmic_spiral.svg')
plt.show()
##########

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
 
This W3C-unspecified plot was created with Matplotlib.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current09:52, 27 September 2016Thumbnail for version as of 09:52, 27 September 2016540 × 540 (40 KB)Adrien F. Vincent (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata