How to change a figure's size in Python Seaborn package
I'm having trouble increasing the size of my plot figures using Seaborn. I'm using sns.pairplot to plot columns of a data frame against one another.
%matplotlib inline
plt.rcParams['figure.figsize']=10,10
columns=list(df.columns.values)
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
The plots populate with data just fine, but the figure size is too small. I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect. I've tried a few different suggestions from online boards, but nothing seems to work.
python plot seaborn
add a comment |
I'm having trouble increasing the size of my plot figures using Seaborn. I'm using sns.pairplot to plot columns of a data frame against one another.
%matplotlib inline
plt.rcParams['figure.figsize']=10,10
columns=list(df.columns.values)
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
The plots populate with data just fine, but the figure size is too small. I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect. I've tried a few different suggestions from online boards, but nothing seems to work.
python plot seaborn
2
Did you try thesize
parameter inpairplot
?
– mwaskom
Oct 31 '15 at 0:36
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
are you viewing these in a notebook? save them as images and i promise they'll be bigger withsize=5
– Paul H
Nov 2 '15 at 5:56
add a comment |
I'm having trouble increasing the size of my plot figures using Seaborn. I'm using sns.pairplot to plot columns of a data frame against one another.
%matplotlib inline
plt.rcParams['figure.figsize']=10,10
columns=list(df.columns.values)
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
The plots populate with data just fine, but the figure size is too small. I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect. I've tried a few different suggestions from online boards, but nothing seems to work.
python plot seaborn
I'm having trouble increasing the size of my plot figures using Seaborn. I'm using sns.pairplot to plot columns of a data frame against one another.
%matplotlib inline
plt.rcParams['figure.figsize']=10,10
columns=list(df.columns.values)
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
The plots populate with data just fine, but the figure size is too small. I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect. I've tried a few different suggestions from online boards, but nothing seems to work.
python plot seaborn
python plot seaborn
asked Oct 30 '15 at 22:54
Vikram JosyulaVikram Josyula
2412514
2412514
2
Did you try thesize
parameter inpairplot
?
– mwaskom
Oct 31 '15 at 0:36
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
are you viewing these in a notebook? save them as images and i promise they'll be bigger withsize=5
– Paul H
Nov 2 '15 at 5:56
add a comment |
2
Did you try thesize
parameter inpairplot
?
– mwaskom
Oct 31 '15 at 0:36
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
are you viewing these in a notebook? save them as images and i promise they'll be bigger withsize=5
– Paul H
Nov 2 '15 at 5:56
2
2
Did you try the
size
parameter in pairplot
?– mwaskom
Oct 31 '15 at 0:36
Did you try the
size
parameter in pairplot
?– mwaskom
Oct 31 '15 at 0:36
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
are you viewing these in a notebook? save them as images and i promise they'll be bigger with
size=5
– Paul H
Nov 2 '15 at 5:56
are you viewing these in a notebook? save them as images and i promise they'll be bigger with
size=5
– Paul H
Nov 2 '15 at 5:56
add a comment |
5 Answers
5
active
oldest
votes
Try to put the size in parenthesis, this does the trick for me:
plt.rcParams['figure.figsize']=(10,10)
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
add a comment |
sns.pairplot
"Returns the underlying PairGrid instance for further tweaking"
...for instance changing the figure size:
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)
add a comment |
In addition to the well working answer by @MartinAnderson, seaborn itself provides the option to set the height of the subplots of the grid. In combination with the aspect
this determines the overall size of the figure in dependence of the number of subplots in the grid.
In seaborn <= 0.8.1:
g = sns.pairplot(..., size=10, aspect=0.6)
In seaborn >= 0.9.0:
g = sns.pairplot(..., height=10, aspect=0.6)
Note that this applies to all seaborn functions which generate a figure level grid, like
pairplot
, relplot
, catplot
, lmplot
and the underlying PairGrid
or FacetGrid
.
For other seaborn plots, which directly plot to axes, the solutions from How do you change the size of figures drawn with matplotlib? will work fine.
add a comment |
If we would like to change only the height or width then we can do
g = sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_figheight(6)
g.fig.set_figwidth(10)
add a comment |
Reffering to Rahul's question about sns.catplot ( Unable to change the plot size with matplotlib and seaborn )
If you try in jupyter notebook:
plt.figure(figsize=(25,20))
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
it is working, but
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
plt.figure(figsize=(25,20))
is not working (plot is very small). It's important to add line plt.figure(figsize=(25,20))
before sns.boxplot()
and include %matplotlib inline
of course in order to display plot in jupyter.
This answer works forboxplot
, but not for any of the plots that create the figure itself likepairplot
(this question) orcatplot
(the question you link to).
– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33446029%2fhow-to-change-a-figures-size-in-python-seaborn-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to put the size in parenthesis, this does the trick for me:
plt.rcParams['figure.figsize']=(10,10)
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
add a comment |
Try to put the size in parenthesis, this does the trick for me:
plt.rcParams['figure.figsize']=(10,10)
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
add a comment |
Try to put the size in parenthesis, this does the trick for me:
plt.rcParams['figure.figsize']=(10,10)
Try to put the size in parenthesis, this does the trick for me:
plt.rcParams['figure.figsize']=(10,10)
edited Nov 15 '16 at 5:17
maxymoo
20.1k34269
20.1k34269
answered Mar 16 '16 at 10:13
S.ZuoS.Zuo
39934
39934
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
add a comment |
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
This does not necessarily work. Use the other answer instead.
– ImportanceOfBeingErnest
Jul 20 '18 at 13:09
add a comment |
sns.pairplot
"Returns the underlying PairGrid instance for further tweaking"
...for instance changing the figure size:
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)
add a comment |
sns.pairplot
"Returns the underlying PairGrid instance for further tweaking"
...for instance changing the figure size:
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)
add a comment |
sns.pairplot
"Returns the underlying PairGrid instance for further tweaking"
...for instance changing the figure size:
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)
sns.pairplot
"Returns the underlying PairGrid instance for further tweaking"
...for instance changing the figure size:
g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)
answered Sep 21 '17 at 14:35
Martin AlexanderssonMartin Alexandersson
24125
24125
add a comment |
add a comment |
In addition to the well working answer by @MartinAnderson, seaborn itself provides the option to set the height of the subplots of the grid. In combination with the aspect
this determines the overall size of the figure in dependence of the number of subplots in the grid.
In seaborn <= 0.8.1:
g = sns.pairplot(..., size=10, aspect=0.6)
In seaborn >= 0.9.0:
g = sns.pairplot(..., height=10, aspect=0.6)
Note that this applies to all seaborn functions which generate a figure level grid, like
pairplot
, relplot
, catplot
, lmplot
and the underlying PairGrid
or FacetGrid
.
For other seaborn plots, which directly plot to axes, the solutions from How do you change the size of figures drawn with matplotlib? will work fine.
add a comment |
In addition to the well working answer by @MartinAnderson, seaborn itself provides the option to set the height of the subplots of the grid. In combination with the aspect
this determines the overall size of the figure in dependence of the number of subplots in the grid.
In seaborn <= 0.8.1:
g = sns.pairplot(..., size=10, aspect=0.6)
In seaborn >= 0.9.0:
g = sns.pairplot(..., height=10, aspect=0.6)
Note that this applies to all seaborn functions which generate a figure level grid, like
pairplot
, relplot
, catplot
, lmplot
and the underlying PairGrid
or FacetGrid
.
For other seaborn plots, which directly plot to axes, the solutions from How do you change the size of figures drawn with matplotlib? will work fine.
add a comment |
In addition to the well working answer by @MartinAnderson, seaborn itself provides the option to set the height of the subplots of the grid. In combination with the aspect
this determines the overall size of the figure in dependence of the number of subplots in the grid.
In seaborn <= 0.8.1:
g = sns.pairplot(..., size=10, aspect=0.6)
In seaborn >= 0.9.0:
g = sns.pairplot(..., height=10, aspect=0.6)
Note that this applies to all seaborn functions which generate a figure level grid, like
pairplot
, relplot
, catplot
, lmplot
and the underlying PairGrid
or FacetGrid
.
For other seaborn plots, which directly plot to axes, the solutions from How do you change the size of figures drawn with matplotlib? will work fine.
In addition to the well working answer by @MartinAnderson, seaborn itself provides the option to set the height of the subplots of the grid. In combination with the aspect
this determines the overall size of the figure in dependence of the number of subplots in the grid.
In seaborn <= 0.8.1:
g = sns.pairplot(..., size=10, aspect=0.6)
In seaborn >= 0.9.0:
g = sns.pairplot(..., height=10, aspect=0.6)
Note that this applies to all seaborn functions which generate a figure level grid, like
pairplot
, relplot
, catplot
, lmplot
and the underlying PairGrid
or FacetGrid
.
For other seaborn plots, which directly plot to axes, the solutions from How do you change the size of figures drawn with matplotlib? will work fine.
answered Jul 20 '18 at 13:41
ImportanceOfBeingErnestImportanceOfBeingErnest
133k13148224
133k13148224
add a comment |
add a comment |
If we would like to change only the height or width then we can do
g = sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_figheight(6)
g.fig.set_figwidth(10)
add a comment |
If we would like to change only the height or width then we can do
g = sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_figheight(6)
g.fig.set_figwidth(10)
add a comment |
If we would like to change only the height or width then we can do
g = sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_figheight(6)
g.fig.set_figwidth(10)
If we would like to change only the height or width then we can do
g = sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_figheight(6)
g.fig.set_figwidth(10)
edited Nov 24 '18 at 16:19
answered Jul 24 '18 at 17:42
JeevanJeevan
5,24384057
5,24384057
add a comment |
add a comment |
Reffering to Rahul's question about sns.catplot ( Unable to change the plot size with matplotlib and seaborn )
If you try in jupyter notebook:
plt.figure(figsize=(25,20))
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
it is working, but
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
plt.figure(figsize=(25,20))
is not working (plot is very small). It's important to add line plt.figure(figsize=(25,20))
before sns.boxplot()
and include %matplotlib inline
of course in order to display plot in jupyter.
This answer works forboxplot
, but not for any of the plots that create the figure itself likepairplot
(this question) orcatplot
(the question you link to).
– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
add a comment |
Reffering to Rahul's question about sns.catplot ( Unable to change the plot size with matplotlib and seaborn )
If you try in jupyter notebook:
plt.figure(figsize=(25,20))
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
it is working, but
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
plt.figure(figsize=(25,20))
is not working (plot is very small). It's important to add line plt.figure(figsize=(25,20))
before sns.boxplot()
and include %matplotlib inline
of course in order to display plot in jupyter.
This answer works forboxplot
, but not for any of the plots that create the figure itself likepairplot
(this question) orcatplot
(the question you link to).
– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
add a comment |
Reffering to Rahul's question about sns.catplot ( Unable to change the plot size with matplotlib and seaborn )
If you try in jupyter notebook:
plt.figure(figsize=(25,20))
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
it is working, but
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
plt.figure(figsize=(25,20))
is not working (plot is very small). It's important to add line plt.figure(figsize=(25,20))
before sns.boxplot()
and include %matplotlib inline
of course in order to display plot in jupyter.
Reffering to Rahul's question about sns.catplot ( Unable to change the plot size with matplotlib and seaborn )
If you try in jupyter notebook:
plt.figure(figsize=(25,20))
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
it is working, but
sns.boxplot(x='CriticRating', y='AudienceRating', data=movies)
plt.figure(figsize=(25,20))
is not working (plot is very small). It's important to add line plt.figure(figsize=(25,20))
before sns.boxplot()
and include %matplotlib inline
of course in order to display plot in jupyter.
answered Jul 20 '18 at 13:08
Dejan MarićDejan Marić
438212
438212
This answer works forboxplot
, but not for any of the plots that create the figure itself likepairplot
(this question) orcatplot
(the question you link to).
– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
add a comment |
This answer works forboxplot
, but not for any of the plots that create the figure itself likepairplot
(this question) orcatplot
(the question you link to).
– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
This answer works for
boxplot
, but not for any of the plots that create the figure itself like pairplot
(this question) or catplot
(the question you link to).– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
This answer works for
boxplot
, but not for any of the plots that create the figure itself like pairplot
(this question) or catplot
(the question you link to).– ImportanceOfBeingErnest
Jul 20 '18 at 13:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33446029%2fhow-to-change-a-figures-size-in-python-seaborn-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Did you try the
size
parameter inpairplot
?– mwaskom
Oct 31 '15 at 0:36
Tried setting size=5 in pairplot to make the images bigger but didn't seem to take effect. I think the problem is that seaborn is trying to place all 10 plots into a single row adjascent to one another, and that makes it too large for the screen unless the plots are shrunk down. I was able to get this to work by plotting the data frame columns separately, but I figured seaborn would have a way to subplot the data frame columns onto different rows automatically without shrinking them down.
– Vikram Josyula
Nov 1 '15 at 18:28
are you viewing these in a notebook? save them as images and i promise they'll be bigger with
size=5
– Paul H
Nov 2 '15 at 5:56