Change tick frequency on X (time, not number) frequency

Whatever reason it is you are getting 2 ticks only by default, you can fix it (customise it) by changing the ticker locator using a date locator. import matplotlib.pyplot as plt import matplotlib.dates as mdates x = [ datetime.datetime(1900,1,1,0,1,2), datetime.datetime(1900,1,1,0,1,3), … ] # ( more than 1000 elements ) y = [ 34, 33, 23, … Read more

Clearing a subplot in Matplotlib

ax.clear() clears the axes. That is, it removes all settings and data from the axes such that you are left with an axes, just as it had been just created. ax.axis(“off”) turns the axes off, such that all axes spines and ticklabels are hidden. ax.set_visible(False) turns the complete axes invisible, including the data that is … Read more

How do I increase the line thickness for sns.lineplot?

As you can see from seaborn.lineplot documentation, the function accepts matplotlib.axes.Axes.plot() arguments, which means you can pass the same arguments you can to matplotlib function in this documentation. If you want to simply adjust the width of your lineplots I find this the easiest: pass an argument linewidth = your_desired_line_width_in_float , for example, linewidth = … Read more

Saving an imshow-like image while preserving resolution

As you already guessed there is no need to create a figure. You basically need three steps. Normalize your data, apply the colormap, save the image. matplotlib provides all the necessary functionality: import numpy as np import matplotlib.pyplot as plt # some data (512×512) import scipy.misc data = scipy.misc.lena() # a colormap and a normalization … Read more