Answers for "x axis values matplotlib"

0

share x axis matplotlib

fig=plt.figure()
ax1 = plt.subplot(211)
ax2 = plt.subplot(212, sharex = ax1)
Posted by: Guest on April-07-2020
0

matplotlib secondary x axis

import matplotlib.pyplot as plt
import numpy as np
import datetime
import matplotlib.dates as mdates
from matplotlib.transforms import Transform
from matplotlib.ticker import (
    AutoLocator, AutoMinorLocator)

fig, ax = plt.subplots(constrained_layout=True)
x = np.arange(0, 360, 1)
y = np.sin(2 * x * np.pi / 180)
ax.plot(x, y)
ax.set_xlabel('angle [degrees]')
ax.set_ylabel('signal')
ax.set_title('Sine wave')


def deg2rad(x):
    return x * np.pi / 180


def rad2deg(x):
    return x * 180 / np.pi

secax = ax.secondary_xaxis('top', functions=(deg2rad, rad2deg))
secax.set_xlabel('angle [rad]')
plt.show()
Posted by: Guest on June-02-2021
0

matplotlive y axis

from matplotlib.pyplot.ylim
plt.ylim(-2, 2)
plt.xlim(0,10)
Posted by: Guest on March-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language