tagged [matplotlib]

Plot a histogram such that bar heights sum to 1 (probability)

Plot a histogram such that bar heights sum to 1 (probability) I'd like to plot a normalized histogram from a vector using `matplotlib`. I tried the following: as well as: but neither option produces a...

21 Nov at 19:27

Histogram Matplotlib

Histogram Matplotlib So I have a little problem. I have a data set in scipy that is already in the histogram format, so I have the center of the bins and the number of events per bin. How can I now pl...

Save matplotlib file to a directory

Save matplotlib file to a directory Here is the simple code which generates and saves a plot image in the same directory as of the code. Now, is there a way through which I can save it in directory of...

7 Jul at 08:48

Display an image with Python

Display an image with Python I tried to use IPython.display with the following code: I also tried to use matplotlib with the following code: In both cases, nothing is displayed, not even an

15 Mar at 22:33

How to make a 3D scatter plot in matplotlib

How to make a 3D scatter plot in matplotlib I am currently have a nx3 matrix array. I want plot the three columns as three axis's. How can I do that? I have googled and people suggested using , but I ...

30 Nov at 15:30

python numpy/scipy curve fitting

python numpy/scipy curve fitting I have some points and I am trying to fit curve for this points. I know that there exist `scipy.optimize.curve_fit` function, but I do not understand the documentation...

reducing number of plot ticks

reducing number of plot ticks I have too many ticks on my graph and they are running into each other. How can I reduce the number of ticks? For example, I have ticks: And I only want: I've tried play...

13 Feb at 00:3

Pandas plot doesn't show

Pandas plot doesn't show When using this in a script (not IPython), nothing happens, i.e. the plot window doesn't appear : Even when adding `time.sleep(5)`, there is still nothing. Why? Is there a way...

18 Dec at 01:23

plot a circle with pyplot

plot a circle with pyplot surprisingly I didn't find a straight-forward description on how to draw a circle with matplotlib.pyplot (please no pylab) taking as input center (x,y) and radius r. I tried ...

9 Feb at 17:23

Change x axes scale in matplotlib

Change x axes scale in matplotlib I created this plot using Matlab ![enter image description here](https://i.stack.imgur.com/8CD22.png) Using matplotlib, the x-axies draws large numbers such as 100000...

10 May at 17:16

How to plot multiple dataframes in subplots

How to plot multiple dataframes in subplots I have a few Pandas DataFrames sharing the same value scale, but having different columns and indices. When invoking `df.plot()`, I get separate plot images...

Intersection of two graphs in Python, find the x value

Intersection of two graphs in Python, find the x value Let 0

17 Dec at 14:51

How to put individual tags for a matplotlib scatter plot?

How to put individual tags for a matplotlib scatter plot? I am trying to do a scatter plot in matplotlib and I couldn't find a way to add tags to the points. For example: I want for the points in "y" ...

25 Jun at 20:43

How to draw vertical lines on a given plot

How to draw vertical lines on a given plot Given a plot of a signal in time representation, how can I draw lines marking the corresponding time index? Specifically, given a signal plot with a time ind...

11 Jul at 09:58

TypeError: 'DataFrame' object is not callable

TypeError: 'DataFrame' object is not callable I've programmed these for calculating Variance I'm getting this error ``` Traceback (most recent call last): File "C:/Python34/project.py", line 11, in ...

5 Sep at 01:12

Superscript in Python plots

Superscript in Python plots I want to label my x axis at follows : But I don't want to have the ^ symbol included . This method works and will superscript letters but doesn't seem to work for numbers ...

20 Jan at 07:0

Plotting a 2D heatmap

Plotting a 2D heatmap Using Matplotlib, I want to plot a 2D heat map. My data is an n-by-n Numpy array, each with a value between 0 and 1. So for the (i, j) element of this array, I want to plot a squ...

16 Oct at 16:7

Saving images in Python at a very high quality

Saving images in Python at a very high quality How can I save Python plots at very high quality? That is, when I keep zooming in on the object saved in a PDF file, why isn't there any blurring? Also, ...

23 Sep at 14:56

How do I plot only a table in Matplotlib?

How do I plot only a table in Matplotlib? Is it possible to draw only a table with matplotlib? If I uncomment the line of this example [code](http://matplotlib.org/examples/pylab_examples/table_demo.h...

3 Dec at 16:24

matplotlib does not show my plot although I call pyplot.show()

matplotlib does not show my plot although I call pyplot.show() Help required on `matplotlib`. Yes, I did not forget calling the `pyplot.show()`. ### $ ipython --pylab It returns `matplotlib.lines.Line...

10 Oct at 16:23

How to change data points color based on some variable

How to change data points color based on some variable I have 2 variables (x,y) that change with time (t). I want to plot x vs. t and color the ticks based on the value of y. e.g. for highest values o...

1 Oct at 22:45

How do I make a single legend for many subplots?

How do I make a single legend for many subplots? I am plotting the same type of information, but for different countries, with multiple subplots with Matplotlib. That is, I have nine plots on a 3x3 gr...

28 Aug at 16:21

Editing the date formatting of x-axis tick labels

Editing the date formatting of x-axis tick labels I am looking to edit the formatting of the dates on the x-axis. The picture below shows how they appear on my bar graph by default. I would like to re...

18 Sep at 22:54

Python Pylab scatter plot error bars (the error on each point is unique)

Python Pylab scatter plot error bars (the error on each point is unique) I am attempting a scatter plot of 2 arrays for which I have a third array containing the absolute error (error in y direction) ...

16 May at 00:27

How to add line based on slope and intercept in Matplotlib?

How to add line based on slope and intercept in Matplotlib? In R, there is a function called `abline` in which a line can be drawn on a plot based on the specification of the intercept (first argument...

2 May at 21:11