Answers for "matplotlib set scale"

3

matplotlib y axis log scale

import pylab
import matplotlib.pyplot as plt
a = [pow(10, i) for i in range(10)]
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1)

line, = ax.plot(a, color='blue', lw=2)

ax.set_yscale('log')

pylab.show()
Posted by: Guest on August-23-2020
10

matplotlib set size

plt.figure(figsize=(20,8))
Posted by: Guest on April-02-2020
0

plt.figure resize

import matplotlib.pyplot as plt
import numpy as np

f = plt.figure(figsize=(10,3))
ax = f.add_subplot(121)
ax2 = f.add_subplot(122)
x = np.linspace(0,4,1000)
ax.plot(x, np.sin(x))
ax2.plot(x, np.cos(x), 'r:')
Posted by: Guest on July-07-2021

Python Answers by Framework

Browse Popular Code Answers by Language