Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set spine and ticks in rcParams?

I tend to use the following axes options in my Matplotlib (v1.3.1) plots:

        ax.spines["top"].set_visible(False)  
        ax.spines["bottom"].set_visible(True)  
        ax.spines["right"].set_visible(False)  
        ax.spines["left"].set_visible(True)  

        ax.get_xaxis().tick_bottom()  
        ax.get_yaxis().tick_left()  

        ax.tick_params(axis="both", which="both", bottom="off", top="off",  
                labelbottom="on", left="off", right="off", labelleft="on")  

This works fine after grabbing the current axis, but I was wondering whether I could make all this default behaviour by setting things in rcParams?

like image 346
Jose Avatar asked Nov 09 '22 18:11

Jose


1 Answers

As mentioned in ImportanceOfBeingErnest's comment, this is now possible:

plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.spines.bottom'] = False
plt.rcParams['axes.spines.left'] = False
plt.rcParams['axes.spines.right'] = False

For multiple rcParams use a dict:

plt.rcParams.update({'axes.spines.top': False, 'axes.spines.right': False})
like image 141
Dan Avatar answered Nov 14 '22 23:11

Dan