How to change feature using marine factor

%pylab inline import pandas as pd import numpy as np import matplotlib as mpl import seaborn as sns typessns = pd.DataFrame.from_csv('C:/data/testesns.csv', index_col=False, sep=';') mpl.rc("figure", figsize=(45, 10)) sns.factorplot("MONTH", "VALUE", hue="REGION", data=typessns, kind="box", palette="OrRd"); 

enter image description here

I always get a small figure, no matter what size I defined in figsize ... How to fix this?

+46
matplotlib seaborn
Oct 02 '14 at 15:00
source share
8 answers

Note added in 2019: in modern versions of Seaborn, the size argument has been renamed to height .

To be a little more specific:

 %matplotlib inline import seaborn as sns exercise = sns.load_dataset("exercise") # Defaults are size=5, aspect=1 sns.factorplot("kind", "pulse", "diet", exercise, kind="point", size=2, aspect=1) sns.factorplot("kind", "pulse", "diet", exercise, kind="point", size=4, aspect=1) sns.factorplot("kind", "pulse", "diet", exercise, kind="point", size=4, aspect=2) 

You want to pass the "size" or "aspect" arguments to sns.factorplot () when plotting.

The size will change the height while maintaining the aspect ratio (therefore, it will also increase when changing only the size).

The aspect will change the width while maintaining a constant height.

The above code should be able to run locally in the ipython notebook.

The size of the graphs in these examples is reduced to show the effects, and also because the graphs from the above code were quite large when saved in png format. It also shows that the size / aspect includes the margin legend.

size = 2 aspect = 1

size = 2, aspect = 1

size = 4, aspect = 1

size = 4, aspect = 1

size = 4 aspect = 2

size = 4, aspect = 2

In addition, all other useful parameters / arguments and default values ​​for this charting function can be viewed after loading the 'sns' module:

 help(sns.factorplot) 
+80
Feb 27 '15 at 12:24
source share

mpl.rc is stored in the global dictionary (see http://matplotlib.org/users/customizing.html ). So, if you want to resize one shape (locally), it will do the trick:

 plt.figure(figsize=(45,10)) sns.factorplot(...) 

It worked for me with matplotlib-1.4.3 and seaborn-0.5.1

+23
Apr 10 '15 at 7:38
source share

The size of the shape is controlled by the size and aspect arguments to factorplot . They correspond to the size of each face (" size " really means "height", and then size * aspect gives the width), so if you are aiming at a specific size for the whole figure, you will need to work back from there.

+5
Oct 03 '14 at 15:12
source share
+3
02 Oct '14 at 15:42
source share

If you just want to scale the shape, use the code below:

 import matplotlib.pyplot as plt plt.figure(figsize=(8, 6)) sns.factorplot("MONTH", "VALUE", hue="REGION", data=typessns, kind="box", palette="OrRd"); // OR any plot code 
+3
Feb 27 '16 at 13:18
source share

import of sea as sns

sns.set (rs = {'figure.figsize' :( 12.7,8.6)})

plt.figure (figsize = (45,10))

This is what I got

+2
Apr 28 '19 at 12:50
source share

Note as of July 2018:

seaborn.__version__ == 0.9.0

Two major changes that affect the above answers

  1. The factorplot function factorplot been renamed catplot()

  2. The size parameter has been renamed height for mesh functions with multiple sections and those that use them.

https://seaborn.pydata.org/whatsnew.html

The value of the response provided by @Fernando Hernandez should be adjusted as shown below:

 %matplotlib inline import seaborn as sns exercise = sns.load_dataset("exercise") # Defaults are hieght=5, aspect=1 sns.catplot("kind", "pulse", "diet", exercise, kind="point", height=4, aspect=2) 
+2
May 01 '19 at 14:21
source share

One of the ways can also be set the size of the figure by passing the dictionary to rc using the parameter "figure.figsize" in the marine method set:

 import seaborn as sns sns.set(rc={'figure.figsize':(11,8)}) 
0
Dec 26 '17 at 15:11
source share



All Articles