Skip to content
Advertisement

Tag: matplotlib

displaying fixed width bars for all datasets in matplotlib

I have the following datasets .I need to plot barchats for say 1,2 or all of them.When I plot the chart for a single data item (eg: xdata=[0] and ydata=[1000], xlabels=[‘first’] , the bar is sclaed to occupy the whole plot area.How do I restrict the barwidth to be say 0.45? When I tried I got this figure But when

How to prevent x-axis labels from overlapping

I’m generating a bar-chart with matplotlib. It all works well but I can’t figure out how to prevent the labels of the x-axis from overlapping each other. Here an example: Here is some sample SQL for a postgres 9.1 database: And this is my python-script: Is there a way how I can prevent the labels from overlapping each other? Ideally

Displaying Matplotlib Navigation Toolbar in Tkinter via grid

I’m developing a small Tkinter GUI to draw matplotlib-plots. (It contains a few Entries and assembles the plot according to their content.) I have designed my plotting widget according to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html, only I use grid instead of pack: That part works. But embedding the NavigationToolbar in the same fashion does not. Tkinter breaks down without error when I include the

Updating a plot in python in real time

I have a python code in which I calculate a quantity for a large number of values of a parameter and then plot the quantity as a function of a parameter. Here is an example However I want that the plot to get dynamically updated such that every time a new element of the q array is calculated it is

How do I set the figure title and axes labels font size?

I am creating a figure in Matplotlib like this: I want to specify font sizes for the figure title and the axis labels. I need all three to be different font sizes, so setting a global font size (mpl.rcParams[‘font.size’]=x) is not what I want. How do I set font sizes for the figure title and the axis labels individually? Answer

matplotlib log scales causes missing points

I’m having a really strange issue with matplotlib. Plotting some points looks like this: When I switch to a log scale on the y-axis, some of the points are not connected: Is this a bug? Am I missing something? Code is below. Comment out the log scale line to see the first graph. Answer log(0) is undefined. I’m guessing matplotlib

Removing white space around a saved image

I need to take an image and save it after some process. The figure looks fine when I display it, but after saving the figure, I got some white space around the saved image. I have tried the ‘tight’ option for savefig method, did not work either. The code: I am trying to draw a basic graph by using NetworkX

Plot Ellipse with matplotlib.pyplot (Python)

Sorry if this is a stupid question, but is there an easy way to plot an ellipse with matplotlib.pyplot in Python? I was hoping there would be something similar to matplotlib.pyplot.arrow, but I can’t find anything. Is the only way to do it using matplotlib.patches with draw_artist or something similar? I would hope that there is a simpler method, but

Advertisement