DNPLab / DNPLab

DNPLab - Bringing the power of Python to DNP-NMR Spectroscopy
http://dnplab.net/
MIT License
7 stars 5 forks source link

matplotlib style definition #409

Closed Bkaribo closed 5 months ago

Bkaribo commented 1 year ago

https://matplotlib.org/stable/users/explain/customizing.html#using-style-sheets

matplotlib allows to use style sheets, it might be useful to allow the use of a "dnplab" style, the corresponding style file could be store along with the config file

advantage: even more consistent plots across dnplab disadvantage: probably this should not be a default option as it could mess with user defined settings, probably a function to 'turn on' dnplab like plotting a la:

dnp.use_dnpstyle(True) or using the context manager option (https://matplotlib.org/stable/users/explain/customizing.html#temporary-styling) or even as an extra parameter for the plot function

Bkaribo commented 11 months ago

Personal comments: Style sheets work best with context manager but this means that no dnp.plt.figure() call should be made before the dnp.plot call

note that this also leads to the classical "cut" title: dnp.plt.figure -> dnp.plot(mydata) -> dnp.plt.title('myttile')

better: dnp.fancy_plot(mydata,title='mytitle')