matplotlib - Use radar chart in a subplot -


i used code produce radar chart: radar chart multiple scales on multiple axes; want place chart in bottom right corner of 2x1 figures set-up. using code below:

fig = pl.figure(figsize=(5, 5))  titles = ['a','b','c','d','e','f'] parameters_list = ['','2','','4','','6','','8','','10'] labels = [parameters_list, parameters_list, parameters_list,parameters_list,parameters_list,parameters_list] radar = radar(fig, titles, labels)  pl.subplot(2, 1, 1) radar.plot([1, 3, 2, 5, 4, 9],  "-", lw=2, color="r", alpha=0.4, label="first") pl.subplot(2, 1, 2) radar.plot([3, 6, 4, 1, 1, 2],  "-", lw=2, color="y", alpha=0.4, label="second") 

this yields 2 blank boxes, while 2 radar charts, 1 above other (see link below).

[1]: http://i.stack.imgur.com/oaxzf.png - 2 blank boxes

if try create single radar chart, code works correctly (see code , link below):

fig = pl.figure(figsize=(5, 5)) titles = ['a','b','c','d','e','f'] parameters_list = ['','2','','4','','6','','8','','10'] labels = [parameters_list, parameters_list, parameters_list,parameters_list,parameters_list,parameters_list] radar = radar(fig, titles, labels)  radar.plot([1, 3, 2, 5, 4, 9],  "-", lw=2, color="r", alpha=0.4, label="first") radar.ax.legend() 

[2]: http://i.stack.imgur.com/lnl6e.png - radar chart working correctly

how can 2 radar charts 1 above other? or how can insert radar in subplot while other subplots show different kind of chart?

since using radar class given in hyry's answer in radar chart multiple scales on multiple axes, here's solution using that:

fig = pl.figure(figsize=(5, 5))  titles = ['a','b','c','d','e','f'] parameters_list = ['','2','','4','','6','','8','','10'] labels = [parameters_list, parameters_list, parameters_list,parameters_list,parameters_list,parameters_list]  radar = radar(fig, titles, labels, rect=[0.0, 0.55, 0.5, 0.45]) radar.plot([1, 3, 2, 5, 4, 9],  "-", lw=2, color="r", alpha=0.4, label="first")  radar = radar(fig, titles, labels, rect=[0.0, 0.0, 0.5, 0.45]) radar.plot([3, 6, 4, 1, 1, 2],  "-", lw=2, color="y", alpha=0.4, label="second") 

result:

enter image description here

i used optional rect parameter in class, provides sizes [left, bottom, width, height] relative full figure.

having done so, don't know why chose use class meant displaying multiple scales, since seem have single scale (duplicated 6 times in labels array), have assume have reason.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -