graphing
Cannot get minor grid lines to appear in matplotlib figure
Unfortunately, ax.grid is a bit confusing in this regard. (This is a design bug / common gotcha.) It turns the minor grid on, but the minor ticks are still turned off. What you need to do is call plt.minorticks_on or ax.minorticks_on in addition to calling ax.grid(True, which=”both”).
Setting axes.linewidth without changing the rcParams global dict
This answer does not work, as it is explained in the comments. I suggest using spines. As mentioned in a comment by Czechnology, consider changing the ticks too. import matplotlib.pyplot as plt fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) ax1.set_title(‘Normal spine and ticks’) ax2.set_title(‘Adjusted spine and ticks’) # change each spine separately: # ax.spines[‘right’].set_linewidth(0.5) … Read more
Matplotlib – Move X-Axis label downwards, but not X-Axis Ticks
use labelpad parameter: pl.xlabel(“…”, labelpad=20) or set it after: ax.xaxis.labelpad = 20
Matplotlib log scale tick label number formatting
Sure, just change the formatter. For example, if we have this plot: import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.axis([1, 10000, 1, 100000]) ax.loglog() plt.show() You could set the tick labels manually, but then the tick locations and labels would be fixed when you zoom/pan/etc. Therefore, it’s best to change the formatter. By default, … Read more
Matplotlib – label each bin
Sure! To set the ticks, just, well… Set the ticks (see matplotlib.pyplot.xticks or ax.set_xticks). (Also, you don’t need to manually set the facecolor of the patches. You can just pass in a keyword argument.) For the rest, you’ll need to do some slightly more fancy things with the labeling, but matplotlib makes it fairly easy. … Read more