matplotlib

MatplotLib - Displaying Data under Graph / Plot

My graph has Xticks Yticks , Xlabels , Ylabels . My Code firmwareList = self.firmware # Gets the list of all firmwares , this is a list I need to put this firmware data under each bar . Basically i need to put the build version below the X axis for each bar. Example | | | | | | ...

Resampling irregularly spaced data to a regular grid in Python

Hi! I need to resample 2D-data to a regular grid. This is what my code looks like: import matplotlib.mlab as ml import numpy as np y = np.zeros((512,115)) x = np.zeros((512,115)) # Just random data for this test: data = np.random.randn(512,115) # filling the grid coordinates: for i in range(512): y[i,:]=np.arange(380,380+4*...

plotting histograms whose bar heights sum to 1 in matplotlib

I'd like to plot a normalized histogram from a vector using matplotlib. I tried the following: plt.hist(myarray, normed=True) as well as: plt.hist(myarray, normed=1) but neither option produces a y-axis from [0, 1] such that the bar heights of the histogram sum to 1. I'd like to produce such a histogram -- how can I do it? thanks...

Python drawing cumulative plot (matplotlib)

Hi, I have not used matplotlib, but looks like it is main library for drawing plots. I want to draw CPU usage plot. I have background processes each minute making record (date, min_load, avg_load, max_load). date could be timestamp or nice formatted date. I want to draw diagram which show min_load, avg_load and max_load on the same plo...

GOOD matplotlib documentation recommendation

Hi, I am new to matplotlib, and after reading the official documentation, I am quite frustrated with it. Could anyone kind enough to recommend a GOOD documentation or user manual or tutorial to learn matplotlib, understandable maybe? Thanks! ...

I embedded a matplotlib graph of a sphere into Tkinter, and can no longer orbit it!

I embedded a matplotlib graph of a sphere into Tkinter. Now for some reason I've lost the ability to orbit the object, when dragging the mouse. Anyone have an idea of why this happened and how to fix this? #!/usr/bin/env python import matplotlib matplotlib.use('TkAgg') from mpl_toolkits.mplot3d import axes3d,Axes3D import matplotli...

Updating a graphs coordinates in matplotlib

I have below a code that will plot a sphere, it's proportions are defined by prop, I'd like it so when the button is pressed prop's value changes to 5 and the graph is adjusted accordingly. How do I go about this? I know tkinter has .configure(), which allows one to adjust widget settings. I'm looking for something similar so that I ca...

How do I remove the y-axis from a Pylab-generated picture?

import pylab # matplotlib x_list = [1,1,1,1,5,4] y_list = [1,2,3,4,5,4] pylab.plot(x_list, y_list, 'bo') pylab.show() What I want to do is remove the y-axis from the diagram, only keeping the x-axis. And adding more margin to the diagram, we can see that a lot of dots are on the edge of the canvas and don't look good. ...

How to change the font size on a matplotlib plot

How does one change the font size for all elements (ticks, labels, title) on a matplotlib plot? I know how to change the tick label sizes, this is done with: import matplotlib matplotlib.rc('xtick', labelsize=20) matplotlib.rc('ytick', labelsize=20) But how does one change the rest? ...

Plotting mplot3d / axes3D xyz surface plot with log scale?

Hi I've been looking high and low for a solution to this simple problem but I can't find it anywhere! There are a loads of posts detailing semilog / loglog plotting of data in 2D e.g. plt.setxscale('log') however I'm interested in using log scales on a 3d plot(mplot3d). I don't have the exact code to hand and so can't post it here, how...

mplot3d - how do I display minor ticks?

Hi How do I display (turn on) minor ticks on a 3D surface plot using mplot3d / axes3d graph? I can define the major tickmark locations using: ax.w_zaxis.set_major_locator(MultipleLocator(10)) Similarly, I'm guessing I can define the the minor ticks using: ax.w_zaxis.set_minor_locator(MultipleLocator(2)) This appears to define the m...

How to make cStringIO transparent to another function that expects a real local file.

Hello everybody! I came up with the following problem: CODE A works right now.. I am saving a png file called chart.png locally, and then I am loading it into the proprietary function (which I do not have access). However, in CODE B, am trying to use cStringIO.StringIO() so that I do not have to write the file "chart.png" to the disk. ...

How do I plot multiple X or Y axes in matplotlib?

I'm currently using matplotlib to plot a measurement against 2 or 3 other measurements (sometimes categorical) on the x-axis. Currently, I am grouping the data on the x-axis into tuples and sorting them before plotting... the result looks something like the left image below. What I would like to do is to plot the data with multiple x-ax...

interactive matplolib through eclipse

is it possible to have an interactive session through pydev for using matplotlib? The problem is that I cannot get shell access to drive the charts as the interpretor halts after the show() command. I would like to have an interactive session through pydev. Interactive sessions are well described by the matplotlib manual here: http://ma...

Add unit to yaxis labels in MatPlotLib

I am trying to add mi or km (miles, kilometers) after the value on the yaxis of a matplotlib bar chart. Right now I am just supplying matplotlib the values and it is making the yaxis labels automatically. I can't figure out how to append mi to the end of a value. 24 > 24 mi There is an option for ax.set_7ticklabels(), but then I ...

how to insert text inside bar if bar color equal to purple

Hi guys! So I've this image : What I trying to do if to leave 'H37Rv' only in the purple bar. My code is the following: rects = ax.bar(ind, num, width, color=colors) for rect in rects: height = int(rect.get_height()) if height < 5: yloc = height + 2 clr = '#182866' else: ...

Python save matplotlib figure on an PIL Image object

HI, is it possible that I created a image from matplotlib and I save it on an image object I created from PIL? Sounds very hard? Who can help me? ...

Matplotlib how to draw on figure on PIL image

I've got a new problem here, I wish to inputs a PIL image object, and then draw the figure that generated from matplotlib, and then return the PIL image object. How could I achieve this? ...

Fix for all-black wx cursors on windows

The following code demonstrates a problem with certain wx cursors on Windows (OSX cursors have a white outline)... namely, they are all black, and therefore completely invisible on a black background. import wx app = wx.PySimpleApp() f = wx.Frame(None) f.SetBackgroundColour(wx.Color(0)) f.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) f.Sho...

weird range value in the colorbar, matplotlib

Hey guys, I am a new user to the python & matplotlib, this might be a simple question but I searched the internet for hours and couldn't find a solution for this. I am plotting precipitation data from which is in the NetCDF format. What I find weird is that, the data doesn't have any negative values in it.(I checked that many times,ju...