python - How do I manipulate multiple x-axes to correspond to each other, while on different scales? -


i trying make color magnitude diagram similar to:

b-v diagram

i have 3 arrays contain exact same number of values.

x1 = b-v (-.5 2)

x2 = temperature. (30,000 3000) , needs log scale

y1 = magnitude (varies based on others)

the x1, x2, , y1 arrays linked, , plot them in scatterplot.

my code:

#plots x1 = bv_array       #b-v x2 = t_array        #temperature y1 = vavg_array     #magnitude fig = plt.figure()  ax1 = fig.add_subplot(111) #ax1.xlim(-.5,2) ax1.plot(x1, y1,'b--') ax2 = ax1.twiny() ax2.plot(x2, y1, 'go') ax2.set_xlabel('temperature') ax2.invert_xaxis()  #ax2.xscale('log') #plt.xscale('log') #plt.scatter(x,y)  #plt.scatter(bv_array, vavg_array, s = 1) plt.gca().invert_yaxis()  plt.show() 

if i'm understanding correctly, should able pick single point on right hand edge of graph axes should aligned, , matplotlib take there.

ax1 = fig.add_subplot(111)  ax1.xlim(-.5,2) # set in axis 1 coords  ax1.plot(x1, y1,'b--') ax2 = ax1.twiny() ax2.plot(x2, y1, 'go') ax2.set_xlabel('temperature') ax2.invert_xaxis()  ax2.xlim(-2, 3) # set in axis 2 coords 

to determine point, work out axis (linear or log) require more 'space' along x axis, set limit max, , convert coordinate space of other axis use limit.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -