python - Getting data of a box plot - Matplotlib -


I want to filter a box plot of some data, which I can easily do with Matplotlib Can i However, I was requested to provide a table with the data presented in it, such as musk, middle, standard deviation, and so on.

I know that I can calculate these by "hand", but I also know from context that boxplot method:

 < Code> Each component of the boxplot gives a mapping in the list of maplotib.lines. Lin-2D example. The lower key in that dictionary (assuming vertical boxplaces): Box: If enabled, the main part of the boxplot showing the interval of the square shape and the mean. Middle: Horizon lines in the center of each box. Mustache: The vertical lines that extends to the most extreme, N-outry data points. Caps: Whispered horizontal lines at the end of the armor: points representing the points that extend Kiny's armor (outliner).  

So I'm thinking how to get these values, because they are matplotlib.lines.Line2D .

Thank you. As you have thought, you need access to the members of the return value of the boxplet. / P>

That is, i.e. If your return value is saved in bp

  BP ['mediates'] [0] .get_ydata ()> & Gt; The array ([2.5, 2.5])  

The boxplate is vertical, and the average row is therefore a horizontal line , you only need to focus on one - Values; That is, the average of my sample data is 2.5.

For each "key" in the dictionary, the value will be a list to handle for multiple boxes. If you have only one boxplate, then there will be only one element in the list, so use my bp ['middle'] [0] . If you have several boxes in your boxpletlet, you will need to re-use them for mediation in BP ['intermediate']

  Madhya Pradesh: linedata = medline.get_ydata () median = Linedata [0]  

CT Zhu does not respond to unfortunately, because different elements behave differently. Apart from this, the example is only a mediocre, but two forks ... Therefore it is the safest to treat each volume manually in the form mentioned above.

Nb nearest you can come is;

  for the key, in bp.items () value: res [key] = [v.get_data () value in v]  
< / Html>

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -