# Matplotlib (20): realization of four Y-axis display in parasitic axis mode

2020-12-08 03:45:52 caimouse

I learned three of them Y Axis way to achieve , In general, the data shows , Can solve the problem , We can finish the experiment report . If you have more factors together , Like four Y Axis , So what to do ？ This paper will solve this problem , Whether you are four Y Axis , Or five Y Axis , Can be solved in this way , In order to solve the problem of Y How much to worry about .

Create a parasitic axis , These axes will share with the body x The proportion , But in y Directions show different proportions . Often in the picture , For example, time is a common spindle , That's shared X Axis , Because time is the same proportion , And then another one Y The axis can represent house prices , One Y The axis can represent the area , One Y The axis represents the location of the subway station , One Y The axis represents the location of the school and so on .

Here, the parasitic axis is used to achieve more Y Axis implementation , With the previous text to achieve 、 And it's a little bit different with hiding , It's using mpl_toolkits.axisartist.parasite_axes Inside HostAxes, and ParasiteAxes. The first is to create a spindle with HostAxes(figure,[ Left , Next , wide , high ]） And then the parasite comes out of its own y Axis , And share x Axis . independent y The axis corresponds to an independent curve Add parasitic axis to the list of spindles . The first parasitic axis can be directly borrowed from the right axis of the original coordinate , So there's no need to add a new axis , If you need more than two y Axis , Third y The shaft is about to build a new fixed shaft , Want to use get_grid_helper().new_fixed_axis Set third and more Y Offset of axis Load the spindle to figure On Set the external characteristics of the axis , For example, color. , Scale range, etc

https://chowdera.com/2020/12/202012080345446245.html