| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../../gallery/misc/../pyplots/../mplot3d/scales3d.html | [Back] [Original] |
Section Navigation
fill_between with transparencyhisttype settingsplt.subplotsfloating_axes featuresNote
Go to the end to download the full example code.
Demonstrate how to use non-linear scales such as logarithmic scales on 3D axes.
3D axes support the same axis scales as 2D plots: 'linear', 'log', 'symlog', 'logit', 'asinh', and custom 'function' scales. This example shows a mix of scales: linear on X, log on Y, and symlog on Z.
For a complete list of built-in scales, see matplotlib.scale. For an overview
of scale transformations, see Scales overview.
import matplotlib.pyplot as plt
import numpy as np
# A sine chirp with increasing frequency and amplitude
x = np.linspace(0, 1, 400) # time
y = 10 ** (2 * x) # frequency, growing exponentially from 1 to 100 Hz
phase = 2 * np.pi * (10 ** (2 * x) - 1) / (2 * np.log(10))
z = np.sin(phase) * x **2 * 10 # amplitude, growing quadratically
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot(x, y, z)
ax.set_xlabel('Time (linear)')
ax.set_ylabel('Frequency, Hz (log)')
ax.set_zlabel('Amplitude (symlog)')
ax.set_yscale('log')
ax.set_zscale('symlog')
plt.show()
[scales3d]References
The use of the following functions, methods, classes and modules is shown in this example:
Tags: plot-type: 3D level: beginner
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-1-g879ad8ebba.
Built with the PyData Sphinx Theme 0.16.1.
| Web Proxy Viewer | New URL | Original Page |