
How do I change the size of figures drawn with Matplotlib?
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20,3) This is very useful when you plot inline (e.g., with IPython Notebook). As asmaier noticed, it is preferable to not put this statement in …
python - How to draw a line with matplotlib? - Stack Overflow
Apr 7, 2016 · I cannot find a way to draw an arbitrary line with matplotlib Python library. It allows to draw horizontal and vertical lines (with matplotlib.pyplot.axhline and matplotlib.pyplot.axvline, for exa...
python - What is the difference between importing matplotlib and ...
Apr 16, 2016 · import matplotlib.pyplot as plt only import this particular submodule and nothing else? I had to do this in order to get access to the hist function. How does that affect the modules normally …
When to use cla (), clf () or close () for clearing a plot
Oct 2, 2023 · Matplotlib offers these functions: cla() # Clear axis clf() # Clear figure close() # Close a figure window When should I use each function and what exactly does it do?
python - Is "from matplotlib import pyplot as plt" == "import ...
May 31, 2015 · from matplotlib import pyplot as plt import matplotlib.pyplot as plt Are the above statements equivalent? Which is more readable/better form?
python - Giving graphs a subtitle - Stack Overflow
Sep 7, 2009 · The shortest answer to your subtitle question is: There is a built-in suptitle() function. Thus, combining suptitle()/title() is similar to the more intuitively named title()/subtitle(). See Floris …
How to plot timestamps in python using matplotlib?
Sep 23, 2015 · ValueError: invalid literal Can I use datetime.datetime.strptime to convert it? If not, then what is the other way of doing it? After converting the timestamp in the proper format, how should I …
python - How to change tick label font size - Stack Overflow
Jun 17, 2011 · In a matplotlib figure, how can I make the font size for the tick labels using ax1.set_xticklabels() smaller? Further, how can one rotate it from horizontal to vertical?
Save plot to image file instead of displaying it - Stack Overflow
This displays the figure in a GUI: import matplotlib.pyplot as plt plt.plot([1, 2, 3], [1, 4, 9]) plt.show() But how do I instead save the figure to a file (e.g. foo.png)?
python - Matplotlib transparent line plots - Stack Overflow
May 15, 2015 · I am plotting two similar trajectories in matplotlib and I'd like to plot each of the lines with partial transparency so that the red (plotted second) doesn't obscure the blue. EDIT: Here's the image