¡@

Home 

python Programming Glossary: plt

Dynamically updating plot in matplotlib

http://stackoverflow.com/questions/10944621/dynamically-updating-plot-in-matplotlib

just to do something like import matplotlib.pyplot as plt import numpy hl plt.plot def update_line hl new_data hl.set_xdata.. like import matplotlib.pyplot as plt import numpy hl plt.plot def update_line hl new_data hl.set_xdata numpy.append hl.get_xdata.. new_data hl.set_ydata numpy.append hl.get_ydata new_data plt.draw Then when you receive data from the serial port just call..

pylab.ion() in python 2, matplotlib 1.1.1 and updating of the plot while the program runs

http://stackoverflow.com/questions/12822762/pylab-ion-in-python-2-matplotlib-1-1-1-and-updating-of-the-plot-while-the-pro

import time import random import matplotlib.pyplot as plt dat 0 1 fig plt.figure ax fig.add_subplot 111 Ln ax.plot dat.. import random import matplotlib.pyplot as plt dat 0 1 fig plt.figure ax fig.add_subplot 111 Ln ax.plot dat ax.set_xlim 0 20.. ax fig.add_subplot 111 Ln ax.plot dat ax.set_xlim 0 20 plt.ion plt.show for i in range 18 dat.append random.uniform 0 1..

How can I attach a pyplot function to a figure instance?

http://stackoverflow.com/questions/14254379/how-can-i-attach-a-pyplot-function-to-a-figure-instance

facecolor 'white' ax fig1.add_subplot 111 ax.contour X Y Z plt.subplots makes it convenient to create a figure and subplots..

How to draw diagrams like this?

http://stackoverflow.com/questions/14824893/how-to-draw-diagrams-like-this

import axes3d import matplotlib.pyplot as plt import numpy as np fig plt.figure ax fig.add_subplot 111 projection.. import matplotlib.pyplot as plt import numpy as np fig plt.figure ax fig.add_subplot 111 projection '3d' dim 10 X Y np.meshgrid.. y 0 y y 0 z y 0 lw 5 linestyle ' ' color 'green' zorder 4 plt.axis 'off' plt.show caveats I am running a version very close..

Generate a heatmap in MatPlotLib using a scatter data set

http://stackoverflow.com/questions/2369492/generate-a-heatmap-in-matplotlib-using-a-scatter-data-set

as np import numpy.random import matplotlib.pyplot as plt # Generate some test data x np.random.randn 8873 y np.random.randn.. x y bins 50 extent xedges 0 xedges 1 yedges 0 yedges 1 plt.clf plt.imshow heatmap extent extent plt.show This makes a 50x50.. bins 50 extent xedges 0 xedges 1 yedges 0 yedges 1 plt.clf plt.imshow heatmap extent extent plt.show This makes a 50x50 heatmap...

Set Colorbar Range in matplotlib

http://stackoverflow.com/questions/3373256/set-colorbar-range-in-matplotlib

I have the following code import matplotlib.pyplot as plt cdict 'red' 0.0 0.25 .25 0.02 .59 .59 1. 1. 1. 'green' 0.0 0.0.. m.colors.LinearSegmentedColormap 'my_colormap' cdict 1024 plt.clf plt.pcolor X Y v cmap cm plt.loglog plt.xlabel 'X Axis'.. 'my_colormap' cdict 1024 plt.clf plt.pcolor X Y v cmap cm plt.loglog plt.xlabel 'X Axis' plt.ylabel..

How can I improve my paw detection?

http://stackoverflow.com/questions/4087919/how-can-i-improve-my-paw-detection

as sp import scipy.ndimage import matplotlib.pyplot as plt from matplotlib.patches import Rectangle def animate input_filename.. with matplotlib we need # ion instead of show ... plt.ion fig plt.figure ax fig.add_subplot 111 fig.suptitle input_filename.. matplotlib we need # ion instead of show ... plt.ion fig plt.figure ax fig.add_subplot 111 fig.suptitle input_filename #..

matplotlib Update a Plot

http://stackoverflow.com/questions/4098131/matplotlib-update-a-plot

tL isubL 'b ' label 'c' plotCanvas FigureCanvasTkAgg f pltFrame toolbar NavigationToolbar2TkAgg plotCanvas pltFrame toolbar.pack.. f pltFrame toolbar NavigationToolbar2TkAgg plotCanvas pltFrame toolbar.pack side BOTTOM plotCanvas.get_tk_widget .pack.. example of the second option import matplotlib.pyplot as plt import numpy as np x np.linspace 0 6 np.pi 100 y np.sin x #..

Is there a matplotlib equivalent of MATLAB's datacursormode?

http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode

to write something similar import matplotlib.pyplot as plt class DataCursor object text_template 'x 0.2f ny 0.2f' x y 0.0.. self.annotation.set_visible True event.canvas.draw fig plt.figure line plt.plot range 10 'ro ' fig.canvas.mpl_connect 'pick_event'.. True event.canvas.draw fig plt.figure line plt.plot range 10 'ro ' fig.canvas.mpl_connect 'pick_event' DataCursor..

Matplotlib: How to put individual tags for a scatter plot

http://stackoverflow.com/questions/5147112/matplotlib-how-to-put-individual-tags-for-a-scatter-plot

find a way to add tags to the points. For example scatter1 plt.scatter data1 x data1 y marker o c blue facecolors white .. matplotlib share improve this question Perhaps use plt.annotate import numpy as np import matplotlib.pyplot as plt.. import numpy as np import matplotlib.pyplot as plt N 10 data np.random.random N 4 labels 'point 0 '.format i for..

Finding number of colored shapes from picture using Python

http://stackoverflow.com/questions/5298884/finding-number-of-colored-shapes-from-picture-using-python

labeled # black white image import matplotlib.pyplot as plt plt.imsave 'labeled_dna.png' labeled plt.imshow labeled plt.show.. # black white image import matplotlib.pyplot as plt plt.imsave 'labeled_dna.png' labeled plt.imshow labeled plt.show.. as plt plt.imsave 'labeled_dna.png' labeled plt.imshow labeled plt.show Output Number of objects is 17 share..

Python/Matplotlib - Is there a way to make a discontinuous axis?

http://stackoverflow.com/questions/5656798/python-matplotlib-is-there-a-way-to-make-a-discontinuous-axis

you just do something like this import matplotlib.pylab as plt import numpy as np # If you're not familiar with np.r_ don't.. spacing. x np.r_ 0 1 0.1 9 10 0.1 y np.sin x fig ax ax2 plt.subplots 1 2 sharey True # plot the same data on both axes ax.plot.. # Make the spacing between the two axes a bit smaller plt.subplots_adjust wspace 0.15 plt.show To add the broken axis..

Multivariate spline interpolation in python/scipy?

http://stackoverflow.com/questions/6238250/multivariate-spline-interpolation-in-python-scipy

np from scipy import ndimage import matplotlib.pyplot as plt # Note that the output interpolated coords will be the same.. mode 'nearest' row column coords nrows ncols data.shape im plt.imshow data interpolation 'nearest' extent 0 ncols nrows 0 plt.colorbar.. data interpolation 'nearest' extent 0 ncols nrows 0 plt.colorbar im plt.scatter column row c zi vmin data.min vmax data.max..

Matplotlib - label each bin

http://stackoverflow.com/questions/6352740/matplotlib-label-each-bin

it fairly easy. As an example import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import FormatStrFormatter.. import FormatStrFormatter data np.random.randn 82 fig ax plt.subplots counts bins patches ax.hist data facecolor 'yellow'.. # Give ourselves some more room at the bottom of the plot plt.subplots_adjust bottom 0.15 plt.show share improve this answer..

why is plotting with Matplotlib so slow?

http://stackoverflow.com/questions/8955869/why-is-plotting-with-matplotlib-so-slow

interactive plotting speeds things up by 1 Frame second plt.ioff tstart time.time # for profiling for i in arange 1 200.. up your code similar to this import matplotlib.pyplot as plt import numpy as np import time x np.arange 0 2 np.pi 0.01 y.. import time x np.arange 0 2 np.pi 0.01 y np.sin x fig axes plt.subplots nrows 6 styles 'r ' 'g ' 'y ' 'm ' 'k ' 'c ' lines..