Python has a visualization library called seaborn based on matplotlib. matplotlib is a little tricky when trying to draw a beautiful graph, but seaborn is recommended because it can draw a beautiful graph quickly.
seaborn has a function called set_context that sets the font size of the graph. By selecting one of the four styles of paper, notebook, talk, and poster for set_context and passing it as an argument, you can change the font size of the graph according to the publication medium.
This article is a memo when comparing the output when each of paper, notebook, talk, poster is passed to set_context.
paper
notebook
talk
poster
Regarding the font size, it increases in the order of paper <notebook <talk <poster.
Paper has very small letters. Although it is called paper, I think that even if you put it in a journal, the characters will be crushed and you will not be able to read it.
It's hard to tell what kind of situation talk is supposed to be, but I think it's probably supposed to be on a slide. However, the graph to be placed on the slide is difficult to read unless the font size is increased, so it may be better to select poster when placing it on the slide.
import seaborn as sns
import matplotlib.pyplot as plt
def draw(context):
sns.set_context(context)
plt.clf()
plt.plot([0, 1], [0, 1])
plt.legend(["line"])
plt.xlabel("this is x label")
plt.ylabel("this is y label")
plt.title(context)
plt.tight_layout()
plt.savefig(context + ".png ")
if __name__ == '__main__':
context_lst = ["paper", "notebook", "talk", "poster"]
[draw(context) for context in context_lst]
Recommended Posts