I am trying to plot two separate quantities on the same graph using twiny as follows:
fig = figure() ax = fig.add_subplot(111) ax.plot(T, r, 'b-', T, R, 'r-', T, r_geo, 'g-') ax.set_yscale('log') ax.annotate('Approx. sea level', xy=(Planet.T_day*1.3,(Planet.R)/1000), xytext=(Planet.T_day*1.3, Planet.R/1000)) ax.annotate('Geostat. orbit', xy=(Planet.T_day*1.3, r_geo[0]), xytext=(Planet.T_day*1.3, r_geo[0])) ax.set_xlabel('Rotational period (hrs)') ax.set_ylabel('Orbital radius (km), logarithmic') ax.set_title('Orbital charts for ' + Planet.N, horizontalalignment='center', verticalalignment='top') ax2 = ax.twiny() ax2.plot(v,r,'k-') ax2.set_xlabel('Linear speed (ms-1)') show()
and the data is presented perfectly, but I have a problem with the fact that the title of the figure overlaps with the axis labels on the secondary x-axis, so that it is barely distinguishable (I wanted to publish an example of the figure here, but I donβt know, t have a fairly high reputation).
I would like to know if there is an easy way to simply shift the name directly by a few tens of pixels so that the diagram looks more beautiful.
python matplotlib title figure
Magic_Matt_Man Oct 05 '12 at 16:26 2012-10-05 16:26
source share