2

I am a python user and have a large dataframe and want to make correlation plot.

I found a good answer to this question at here. pandas scatter matrix display correlation coefficient

However, my dataframe is bigger than he suggested and mine has more rows and columns like below. (np.random.randn(1000, 6), columns=['a', 'b', 'c', 'd','e','f'])

If I use his method, the figure will be tight and each plot will be quite small. Is there any way to make plot bigger? Also, if you could tell me how to make the font bigger, I would be grateful for that. Thank you very much for your help.

Joe
  • 12,057
  • 5
  • 39
  • 55
Tom_Hanks
  • 517
  • 1
  • 6
  • 15

3 Answers3

4

scatter_matrix takes a variable figsize that controls the size. Documentation here. So you can change the size as you want:

scatter_matrix(df, alpha=0.5, figsize=(12, 12), diagonal='kde')

to change the size.

3

Add figsize=(15, 10) in:

axes = scatter_matrix(df, alpha=0.5, diagonal='kde', figsize=(15, 10))

and fontsize=12 in:

axes[i, j].annotate("%.3f" %corr[i,j], (0.8, 0.8), xycoords='axes fraction', ha='center', va='center', fontsize=12)
Joe
  • 12,057
  • 5
  • 39
  • 55
0

use plot.figure(figsize=(sizeX,sizeY)) before plotting.

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
WagnerAlbJr
  • 190
  • 1
  • 12