Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keywords arguments in matplotlib radviz

I am trying to understand the keyword arguments that can be used in matplotlib radviz. I am using the well-known iris dataset, and the simple code below:

import pandas as pd
plt.xkcd()
iris = pd.read_csv("iris.csv")
pd.tools.plotting.radviz(iris, "name")

Generating the following chart:radviz plot

How can I setup the dimensions (x, y) and the title of the chart? How can I specify the placement of the legend? What other arguments (if any) can be used with radviz?

Thank you very much for your help.

like image 254
Luis Miguel Avatar asked Apr 15 '26 01:04

Luis Miguel


1 Answers

all the pandas plotting tools take an ax argument, you can make the axis and pass to the plotting function:

fig = plt.figure( )
ax = fig.add_axes( [.05, .05, .9, .9], title='whatever title' )
pd.tools.plotting.radviz( iris, 'name', ax=ax )

then if you need to change the legend, you may do:

ax.legend( loc='center right', fontsize='medium' )

or change the title:

ax.set_title( 'new title' )

alternatively, i believe the plotting tools return the axis after plotting, so you may do

ax = pd.tools.plotting.radviz( iris, 'name')

and check dir( ax ) for some of the functionality available.

with plt.xkcd( ):
    ax = pd.tools.plotting.radviz(df, 'Name')
    ax.legend( loc='center left', bbox_to_anchor=(0, 1),
               fontsize='medium', fancybox=True, ncol=3 )
    ax.set_xlim( -1.6, 1.6, emit=True, auto=False )
    ax.set_title( 'iris - radviz', loc='right' )

iris

like image 133
behzad.nouri Avatar answered Apr 16 '26 22:04

behzad.nouri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!