Questions tagged [lmplot]

31 questions
132
votes
2 answers

How to set the xlim and ylim of a FacetGrid

I'm using sns.lmplot to plot a linear regression, dividing my dataset into two groups with a categorical variable. For both x and y, I'd like to manually set the lower bound on both plots, but leave the upper bound at the Seaborn default. Here's a…
exp1orer
  • 11,481
  • 7
  • 38
  • 51
32
votes
2 answers

How to change the marker size in lmplot

I am trying to change the size of the lmplot markers in seaborn. I have tried passing 's' or 'size' as arguments and neither of them work. lm = sns.lmplot(x="totalX",y="NormI", hue="Data Type", data=df, palette="Set1", legend_out=False, S=20) I…
galucero
  • 353
  • 1
  • 4
  • 9
23
votes
4 answers

Annotate the linear regression equation

I tried fitting an OLS for Boston data set. My graph looks like below. How to annotate the linear regression equation just above the line or somewhere in the graph? How do I print the equation in Python? I am fairly new to this area. Exploring…
Naive_Natural2511
  • 687
  • 2
  • 8
  • 20
3
votes
1 answer

using lmplot in Seaborn PairGrid

I am trying to plot a PairGrid using density estimates on the diagonal, scatterplots in the upper triangular part, and pairwise linear regression models in the lower triangular part. This is my dataftame: df.head() And here is my code: g =…
Kasra
  • 1,959
  • 1
  • 19
  • 29
1
vote
0 answers

Logistic Regression in seaborn does not show the line

I have a simple dataframe with continous and categorical column: Unemployment Rate AcceptsCash E020 0.058080 0 E021 …
Sam333
  • 199
  • 14
1
vote
1 answer

How to annotate each lmplot facet by hue group or combined data

I'm trying to add annotations to lmplots in a FacetGrid (r and p values for each regression) but the plots have two regression lines because I'm using "hue", and therefore I get two annotations that are stacked on top of each other. I'd like to…
1
vote
1 answer

format x-axis (dates) in sns.lmplot()

I have daily data that I need to plot with sns.lmplot(). The data has the following structure: df = pd.DataFrame(columns=['date', 'origin', 'group', 'value'], data = [['2001-01-01', "Peter", "A", 1.0], …
Ivo
  • 3,890
  • 5
  • 22
  • 53
1
vote
0 answers

I get the error message: (invalid index to scalar variable) when I do seaborn lmplot in Python

I'm trying to visualize Worldometer Covid19 data, but when I do seaborn lmplot, I get an error message that says: IndexError: Invalid index to scalar variable. The plots are shown as well with the error, but I prefer to show them without the error…
Hanan Tabak
  • 21
  • 1
  • 5
1
vote
2 answers

How to convert numpy one dimensional array to Pandas Series or Dataframe

I have spent quiet some time on what seems to be very easy thing. All I want is to convert a numpy array to a Series and then combine Series to make a dataframe. I have two numpy arrays. import numpy as np rooms = 2*np.random.rand(100, 1) + 3 price…
Dr. Mian
  • 3,334
  • 10
  • 45
  • 69
1
vote
0 answers

Using Seaborn: lmplot's

I am trying to create a lmplot using these variables The code is supposed to create subplots based of the manuf column This is my current code and the error I am getting: sns.lmplot(x="Carbo", y="Sugars", col='Manuf',data=cereals_data3) TypeError:…
user13599115
  • 43
  • 1
  • 5
1
vote
0 answers

How to set figure size in lmplot seaborn?

My attempts to set figure size in lmplot have failed and therefore I would welcome your advice. My code: sns.set(rc={'figure.figsize':(18,16)}) sns.lmplot(x = 'index', y = 'values', data = data.reset_index(), hue = 'data' ) The plot that is…
user8270077
  • 4,621
  • 17
  • 75
  • 140
0
votes
2 answers

markers that differ from hue in seaborn lmplot

I'm trying to create a figure with seaborn lmplot. I use hue to color the different levels for one category. But I'd like to have the marker shape for each point correspond to a different category than hue. However sns.lmplot will only accept…
BML
  • 191
  • 2
  • 12
0
votes
0 answers

Why am I getting an error for two of the same blocks of code?

I wrote basically two blocks of code exactly the same assign from the variables but I'm getting and error saying, "Setting an Array with a sequence". This is my code that didn't work: east_fg_data = [["Heat", miaFG, miaWin], ["Knicks", nykFG,…
0
votes
0 answers

Facing some trouble when plotting a pandas dataframe using seaborn lmplot with arrays of different shapes

When running the following code, I ran into the problem: All arrays must be of same length. I am trying to generate a pandas dataframe so that I can plot it using seaborn lmplot, but it's not working. I tried this: import pandas as pd import numpy…
0
votes
0 answers

How to produce an equation for graphs using seaborn.lmplot()

So I need to produce an equation for my regression lines which I have obtained using the lmplot function. Any help greatly appreciated :) sns.lmplot(x='Timestamp_s', y='Heart_Rate(bpm)', hue='Subject', col='Subject', data=Activity1); I've tried…
1
2 3