I have the following problem and I am totally new to matplotlib and python: To produce high qualitiy plots for my thesis I want to use matplotlib and I want to use the latex commands for the axes etc. When I try the following example (from http://matplotlib.org/users/usetex.html#usetex-tutorial):
import numpy as np
import matplotlib.pyplot as plt
# Example data
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(4 * np.pi * t) + 2
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.plot(t, …Run Code Online (Sandbox Code Playgroud) 我使用以下脚本进行绘图:
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
import math
import matplotlib as mpl
from matplotlib.ticker import MultipleLocator
from matplotlib.colors import LinearSegmentedColormap
cdict1 = {'red': ((0.0, 1.0, 1.0),
(0.4, 1.0, 1.0),
(0.7, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'green': ((0.0, 1.0, 1.0),
(0.1, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'blue': ((0.0, 1.0, 1.0),
(0.1, 0.0, 0.0),
(0.4, 0.0, 0.0),
(1.0, 1.0, 1.0))
}
white_blue_red = LinearSegmentedColormap('WhiteBlueRed', cdict1)
plt.register_cmap(cmap=white_blue_red)
x = np.loadtxt('data.dat',
unpack=True)
plt.scatter(x[0], x[1], marker='.', …Run Code Online (Sandbox Code Playgroud)