File:Mpl example Rosenbrock function.svg
Original file (SVG file, nominally 720 × 540 pixels, file size: 1.21 MB)
Captions
Summary
[edit]DescriptionMpl example Rosenbrock function.svg |
English: Rosenbrock function over , plotted with matplotlib (and with "inferno", a perceptually monotonic colormap). |
Date | |
Source | Own work |
Author | Adrien F. Vincent |
Rationale: this work aims at providing an up-to-date version of the similar work https://commons.wikimedia.org/wiki/File:Rosenbrock_function.svg , done by Morn the Gorn.
Source code has been slightly modified into fully object-oriented matplotlib interface. It now uses the "inferno" colormap, instead of "jet" which produces perceptual glitches.
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 mpl_toolkits.mplot3d import Axes3D
from matplotlib.cm import inferno as colormap
from matplotlib.colors import LogNorm
fig = plt.figure()
fig.clf()
ax = Axes3D(fig, azim=-128.0, elev=43.0)
s = 0.05
x = np.arange(-2.0, 2.0 + s, s)
y = np.arange(-1.0, 3.0 + s, s)
X, Y = np.meshgrid(x, y)
Z = (1.0 - X)**2 + 100.0 * (Y - X*X)**2
# Without using `` linewidth=0, edgecolor='none' '', the code may produce a
# graph with wide black edges, which will make the surface look much darker.
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, norm=LogNorm(),
cmap=colormap, linewidth=0, edgecolor='none')
ax.set_xlim([-2, 2])
ax.set_ylim([-1, 3])
ax.set_zlim([0, 2500])
ax.set_xlabel("x")
ax.set_ylabel("y")
fig.savefig("Rosenbrock function.svg")
plt.show()
##########
Licensing
[edit]- 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.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 09:52, 27 September 2016 | 720 × 540 (1.21 MB) | Adrien F. Vincent (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on bn.wikipedia.org
- Usage on en.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on pt.wikipedia.org
- Usage on tr.wikipedia.org
- Usage on zh.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 576pt |
---|---|
Height | 432pt |