0

I would like to do a plot similar to this photo: Plot with several y-axis with different scales (source is from here).

So the goal is to have several y-axis with different scales on the same plot for several curves.

I tried the following in python for now, which allow me to have a plot looking similar when it is empty.

But I have an issue with the axis when starting to enter some data: in my code, the ith axis will scale to the values the data have when it reaches i+1th axis, although we would obviously like it to have a scale only dependant to value the curve has at the current ith axis. This issue also is the cause of the discontinuity of the curves.

I would be very thankful if you had any suggestions or ideas :)

fig, (ax, ax1, ax2, ax3, ax4, ax5) = plt.subplots(1, 6) 

chartBox = ax1.get_position() 
ax1.set_position([chartBox.x0-0.022,  
                  chartBox.y0, 
                  chartBox.width, 
                  chartBox.height]) 
chartBox = ax2.get_position() 
ax2.set_position([chartBox.x0-0.044,  
                  chartBox.y0, 
                  chartBox.width, 
                  chartBox.height]) 
chartBox = ax3.get_position() 
ax3.set_position([chartBox.x0-0.066,  
                  chartBox.y0, 
                  chartBox.width, 
                  chartBox.height]) 
chartBox = ax4.get_position() 
ax4.set_position([chartBox.x0-0.088,  
                  chartBox.y0, 
                  chartBox.width, 
                  chartBox.height]) 
chartBox = ax5.get_position() 
ax6=ax5.twinx()
ax5.set_position([chartBox.x0-0.112,  
                  chartBox.y0, 
                  chartBox.width, 
                  chartBox.height]) 
  
    
    
ax.set_xticks([])
ax1.set_xticks([])
ax2.set_xticks([])
ax3.set_xticks([])
ax4.set_xticks([])
ax5.set_xticks([])
ax6.set_xticks([])

Hyper=[0.785,0.890275,6.443702104245254
]
Bayes=[0.789,0.88805,6.325708590132482

]
Ax=[0.817,0.885175,6.133054804498614

]
NG=[0.8,0.884825,6.290438322234702

]
BOHB=[0.785,0.8876999999999999,6.173551552576356


]
Ran=[0.787,0.884175,6.170678868638696

]
Zoo=[0.795,0.884625,6.325670890740688

]

j=0
tmp=ax
tmp.plot(Hyper[j:j+2])
tmp.plot(Bayes[j:j+2])
tmp.plot(Ax[j:j+2])
tmp.plot(NG[j:j+2])
tmp.plot(BOHB[j:j+2])
tmp.plot(Ran[j:j+2])
tmp.plot(Zoo[j:j+2])


tmp=ax1
j=1
tmp.plot(Hyper[j:j+2])
tmp.plot(Bayes[j:j+2])
tmp.plot(Ax[j:j+2])
tmp.plot(NG[j:j+2])
tmp.plot(BOHB[j:j+2])
tmp.plot(Ran[j:j+2])
tmp.plot(Zoo[j:j+2])

plt.show() 

(I only put data for 3 axis here as I think an idea working for 3 axis would also work for 7 axis)

AJSV
  • 21
  • 3
  • [twinx](https://matplotlib.org/gallery/api/two_scales.html) can be used to instantiate different y-axis with different scale which shares same x-axis. You can instantiate multiple of these. – Shivam Miglani Nov 29 '20 at 01:04
  • I found a way to do what I wanted to do [here](https://stackoverflow.com/questions/8230638/parallel-coordinates-plot-in-matplotlib) – AJSV Nov 29 '20 at 14:06
  • @AJSV As you found the name of what you want to make in "parallel coordinates". I am going to mark it as a duplicate of the question you link to. Good luck! – tacaswell Nov 29 '20 at 19:42

0 Answers0