Yahoo奇摩 網頁搜尋

搜尋結果

  1. 2008年12月1日 · Using plt.rcParams There is also this workaround in case you want to change the size without using the figure environment. So in case you are using plt.plot() for example, you can set a tuple with width and height. import matplotlib.pyplot as plt plt.rcParams

  2. One thing you can do is to set your axis range by yourself by using matplotlib.pyplot.axis. matplotlib.pyplot.axis. from matplotlib import pyplot as plt. plt.axis([0, 10, 0, 20]) 0,10 is for x axis range. 0,20 is for y axis range. or you can also use matplotlib.pyplot.xlim or matplotlib.pyplot.ylim.

  3. 2016年4月7日 · The line will span the full range of your plot (independently on how big it is), and the creation of the line doesn't rely on any data point within the axis, but only in two fixed points that you need to specify. import numpy as np. x = np.linspace(0,10) y = x**2. p1 = [1,20] p2 = [6,70] plt.plot(x, y)

  4. 2017年6月7日 · 60. plt.show() will display the current figure that you are working on. plt.draw() will re-draw the figure. This allows you to work in interactive mode and, should you have changed your data or formatting, allow the graph itself to change. The plt.draw docs state:

  5. Many "correct" answers here but I'll add one more since I think some details are left out of several. The OP asked for 90 degree rotation but I'll change to 45 degrees because when you use an angle that isn't zero or 90, you should change the horizontal alignment as well; otherwise your labels will be off-center and a bit misleading (and I'm guessing many people who come here want to rotate ...

  6. 2023年10月2日 · plt.cla() clears an axis, i.e. the currently active axis in the current figure. It leaves the other axes untouched. plt.clf() clears the entire current figure with all its axes, but leaves the window opened, such that it may be reused for other plots. plt.close() closes a window, which will be the current window, if not specified otherwise.

  7. 2023年12月4日 · As suggested before, you can either use: import matplotlib.pyplot as plt. plt.savefig("myfig.png") For saving whatever IPhython image that you are displaying. Or on a different note (looking from a different angle), if you ever get to work with open cv, or if you have open cv imported, you can go for: import cv2.

  8. Joe Kington's excellent answer is already 4 years old, Matplotlib has incrementally changed (in particular, the introduction of the cycler module) and the new major release, Matplotlib 2.0.x, has introduced stylistic differences that are important from the point of view of the colors used by default.

  9. 2013年9月26日 · 2. I tried to run, on IDLE, the following example code, which was copied from matplotlib's official website: import numpy as np. import matplotlib.pyplot as plt. x = np.arange(0, 5, 0.1); y = np.sin(x) plt.plot(x, y) But I got lots of errors: Traceback (most recent call last):

  10. Here is a small example how to add a matplotlib grid in Gtk3 with Python 2 (not working in Python 3): #!/usr/bin/env python #-*- coding: utf-8 -*- import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from matplotlib.figure import Figure from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas win = Gtk.Window() win.connect("delete-event", Gtk.main ...

  1. 其他人也搜尋了