File:Mpl example histogram.svg

From WikiLectures

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

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Histogram using matplotlib
Date
Source Own work
Author Adrien F. Vincent

Rationale: this work aims at providing an updated version of the previous work https://commons.wikimedia.org/wiki/File:Matplotlib_histogram_v.svg , done by IkamusumeFan,

Source code has been (very) slightly modified into fully object-oriented matplotlib interface. A pseudo-random generator is used with a constant seed to ensure reproducibility when updating in the futre. The original shebang was also removed.

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

##########
## Code for the figure
##########
"""This generates an histogram of 200 normal distributed samples."""

import matplotlib.pyplot as plt
import numpy as np
prng = np.random.RandomState(123)  # Set a fix-seed PRNG for reproducibility

fig, ax = plt.subplots()

x = prng.normal(size=200)
ax.hist(x, bins=30)

fig.savefig("matplotlib_histogram.svg")
plt.show()
##########

Licensing

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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

26 September 2016

File history

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

Date/TimeThumbnailDimensionsUserComment
current11:52, 27 September 2016Thumbnail for version as of 11:52, 27 September 2016720 × 540 (24 KB)wikimediacommons>Adrien F. VincentUser created page with UploadWizard

The following page uses this file:

Metadata