python - Use spines and tick_params in Matplotlib style sheet -
python - Use spines and tick_params in Matplotlib style sheet -
i have next python 3 code generating plot matplotlib
:
import numpy np import matplotlib.pyplot py x = np.arange(0, 10, 0.1) y = np.sin(x) py.figure(1) py.plot(x, y, c='g', lw=2) py.ylim(-1.1, 1.1) py.title('plot title') py.ylabel('y label') py.xlabel('x label') py.gca().spines['top'].set_visible(false) py.gca().spines['right'].set_visible(false) py.gca().spines['bottom'].set_visible(false) py.gca().spines['left'].set_visible(false) py.tick_params(top='off', right='off', bottom='off', left='off') py.grid() py.show()
this preferred configuration creating plots no axis borders or tick marks. axis labels, title, , grid remain. instead of writing spines
, tick_params
every plot figure, tried add together parameters mplstyle
file. however, style file doesn't back upwards these features. there way create default configuration figures?
using axes.linewidth
, major.width
parameters in style sheet, i'm able replicate same effects spine
, tick_params
. next using in style sheet desired effects:
lines.linewidth : 2 axes.grid : true axes.linewidth : 0 xtick.major.width : 0 ytick.major.width : 0 grid.color : black
and here plot style creates:
python python-3.x numpy matplotlib
Comments
Post a Comment