python - Parasite axis appearing at two positions and overlapping -


Using this example as a guide: I tried to create a plan with several axes which was using twinning instead of twinx.

However, in both one- par2 top of the axes and the position appears in both par1 overlapping on top What am I doing wrong?

  plt host = host_subplot (111, axes_class = AA.Axes) as a.A. pl..subplots_adjust Import matplotlib.pyplot as mpl_toolkits.axes_grid1 import host_subplot import Parl = Hostktwiny (from mpl_toolkits.axisartist (down = 0.2)) par2 = host.twiny () new_fixed_axis = par2.get_grid_helper (). New_fixed_axis par2.axis ["bottom"] = new_fixed_axis (loc = "bottom", axis = par2, = offset (0, -40)) par2.axis ["bottom"]. Toggle (all = true) host.set_xlim (0, 2) host.set_ylim (0, 2) host.set_ylabel ( "distance") host.set_xlabel ( "density") par1.set_xlabel ( "Temperature") par2.set_xlabel ( "Velocity") p1, = host.plot ([0, 1, 2], [0, 1, 2], label = "density") p2, = Par1.plot ([0, 3, 2], [0 , 1, 2], label = "temperature") p3, = par2.plot ([50, 30, 15], [0, 1, 2], label = "velocity") par1.set_xlim (0, 4) par2 .set_xlim (1, 65) host.legend () host.axis ["bottom"]. label.set_color (p1.get_color ()) par1.axis ["top"]. Label .SetLoller (P2GateColter ()) Para 2.Xx ["Down"]. Leblkset_ color example Matplotlib website (p3.get_color ()) plt.draw () plt.show () and the difference between your code that you add    

par2 = host.twiny () to set up the call to par2 sets the top axis and new_fixed_axis (for ) is not undone by the call, so you have to stop using it, Toggle (all = false)

Note, oddly, change can also get it rather than down:

  par2.axis [ "top"] = new_fixed_axis (loc = "bottom", axes = par2, offset = (0, -40 ))   

But this could possibly result in delusional flood Look forward to the world.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -