axis-labels
Curve Fitting to a time series in the format ‘datetime’?
Instead of plotting datenums, use the associated datetimes. import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import datetime as DT import time dates = [DT.datetime(1978, 7, 7), DT.datetime(1980, 9, 26), DT.datetime(1983, 8, 1), DT.datetime(1985, 8, 8)] y = [0.00134328779552718, 0.00155187668863844, 0.0039431374327427, 0.00780037563783297] yerr = [0.0000137547160254577, 0.0000225670232594083, 0.000105623642510075, 0.00011343121508] x = mdates.date2num(dates) … Read more
Rotate axis tick labels
This works for me: plt.xticks(rotation=90)
Show decimal places and scientific notation on the axis
This is really easy to do if you use the matplotlib.ticker.FormatStrFormatter as opposed to the LogFormatter. The following code will label everything with the format ‘%.2e’: import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mtick fig = plt.figure() ax = fig.add_subplot(111) x = np.linspace(0, 300, 20) y = np.linspace(0,300, 20) y = … Read more
Overlapping yticklabels: Is it possible to control cell size of heatmap in seaborn?
The only way to make more room for the labels is to increase the height of the matrix. The only other option would be to decrease the font size, but I guess that’s not what you want. So you can compute the ideal figure height based on the number of rows in the matrix and … Read more
matplotlib: adding padding/offset to polar plots tick labels
First of all; seeing as how you have specified the figsize to be (2,2) and having the ax occupy 80 % of both the width and height, you have very little space left over to pad the ticklabels. This could cause the ticklabels to be “cut off” at the figure’s egdes. This can easily be … Read more
pROC ROC curves remove empty space
Make sure the plotting device is square and adjust the margins so that top + bottom == left + right: library(pROC) png(“test.png”, width = 480, height = 480) par(mar = c(4, 4, 4, 4)+.1) n = c(4, 3, 5) b = c(TRUE, FALSE, TRUE) rocobj <- plot.roc(b, n, percent = TRUE, main=”ROC”, col=”#1c61b6″, add=FALSE) dev.off()