Skip to main content

All Questions

274 votes
7 answers
225k views

warning about too many open figures

In a script where I create many figures with fix, ax = plt.subplots(...), I get the warning RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (...
andreas-h's user avatar
  • 11.1k
170 votes
12 answers
243k views

FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison

I am using Pandas 0.19.1 on Python 3. I am getting a warning on these lines of code. I'm trying to get a list that contains all the row numbers where string Peter is present at column Unnamed: 5. df =...
user avatar
107 votes
6 answers
393k views

How to draw a line with matplotlib?

I cannot find a way to draw an arbitrary line with matplotlib Python library. It allows to draw horizontal and vertical lines (with matplotlib.pyplot.axhline and matplotlib.pyplot.axvline, for ...
Alexey's user avatar
  • 4,091
88 votes
4 answers
467k views

Change figure size and figure format in matplotlib [duplicate]

I want to obtain fig1 exactly of 4 by 3 inch sized, and in tiff format correcting the program below: import matplotlib.pyplot as plt list1 = [3,4,5,6,9,12] list2 = [8,12,14,15,17,20] plt.plot(list1,...
golay's user avatar
  • 971
74 votes
5 answers
76k views

How to plot multiple Seaborn Jointplot in Subplot

I'm having problem placing Seaborn Jointplot inside a multicolumn subplot. import pandas as pd import seaborn as sns df = pd.DataFrame({'C1': {'a': 1,'b': 15,'c': 9,'d': 7,'e': 2,'f': 2,'g': 6,'h': ...
Afloz's user avatar
  • 3,675
57 votes
4 answers
234k views

Add Legend to Seaborn point plot

I am plotting multiple dataframes as point plot using seaborn. Also I am plotting all the dataframes on the same axis. How would I add legend to the plot ? My code takes each of the dataframe and ...
Spandan Brahmbhatt's user avatar
56 votes
2 answers
145k views

How to remove or hide x-axis labels from a plot

I have a boxplot and need to remove the x-axis ('user_type' and 'member_gender') label. How do I do this given the below format? sb.boxplot(x="user_type", y="Seconds", data=df, color = default_color, ...
LaLaTi's user avatar
  • 1,725
55 votes
3 answers
57k views

Matplotlib giving error "OverflowError: In draw_path: Exceeded cell block limit"

I'm trying to render an image using matplotlib with 100000000 data points and it produces the error OverflowError: In draw_path: Exceeded cell block limit. Is there a limit in the amount of data ...
Lou's user avatar
  • 1,163
51 votes
2 answers
76k views

How to draw horizontal grid only (using pandas plot + pyplot)

I would like to get only horizontal grid using pandas plot. The integrated parameter of pandas only has grid=True or grid=False, so I tried with matplotlib pyplot, changing the axes parameters, ...
Aurelie Navir's user avatar
51 votes
2 answers
48k views

Matplotlib scatter plot with unknown error

I am attempting to create a scatter plot. I have a list of numbers from 0 - 17 as well as an array with 18 values. I can plot the data as a line plot but when I try to plot as a scatter, I get an ...
Bogdan Janiszewski's user avatar
48 votes
2 answers
112k views

Hide axis label only, not entire axis, in Pandas plot

I can clear the text of the xlabel in a Pandas plot with: plt.xlabel("") Instead, is it possible to hide the label? May be something like .xaxis.label.set_visible(False).
KcFnMi's user avatar
  • 6,227
40 votes
5 answers
152k views

cumulative distribution plots python

I am doing a project using python where I have two arrays of data. Let's call them pc and pnc. I am required to plot a cumulative distribution of both of these on the same graph. For pc it is supposed ...
akhiljain's user avatar
  • 651
40 votes
4 answers
47k views

How to convert Matplotlib figure to PIL Image object (without saving image)

As the title states, I am trying to convert a fig to a PIL.Image. I am currently able to do so by first saving the fig to disk and then opening that file using Image.open() but the process is taking ...
Zach's user avatar
  • 1,361
38 votes
4 answers
190k views

How to add a variable to Python plt.title? [duplicate]

I am trying to plot lots of diagrams, and for each diagram, I want to use a variable to label them. How can I add a variable to plt.title? For example: import numpy as np import matplotlib.pyplot as ...
JoeJackJessieJames's user avatar
38 votes
1 answer
90k views

Set variable point size in matplotlib

I want to set a variable marker size in a scatter plot. This is my code: import numpy as np import matplotlib.pyplot as plt from os import getcwd from os.path import join, realpath, dirname mypath =...
Gabriel's user avatar
  • 42.6k

15 30 50 per page
1
2 3 4 5
222