Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug report
Bug summary
In a previous version of matplotlib, I was able to reposition and stretch a curvilinear coordinate axis created with floating_axes.FloatingSubplot after the axis has been created using Dividers andax.set_axes_locator()
. Now in matplotlib version 3.3.4 I can only get the axis to translate, but not stretch.
Code for reproduction
#!/usr/bin/env python3frommatplotlibimportpyplotaspltfrommatplotlib.transformsimportAffine2D,Transformimportmpl_toolkits.axisartist.floating_axesasfloating_axesfrommatplotlib.projectionsimportpolarfrommpl_toolkits.axisartist.grid_finderimportFixedLocator,DictFormatterimportmpl_toolkits.axes_grid1.axes_sizeasSizefrommpl_toolkits.axes_grid1importDividerfig=plt.figure()# Generate first axis using normal methods.ax0=fig.add_subplot(111)ax0.set_xticks([0,500,1000,1500,2000])# Generate a curvilear axis for the second axis.angle_ticks= [(0,'0'), (0.079,'500'), (0.157,'1000'), (0.235,'1500'), (0.314,'2000')]grid_locator1=FixedLocator([vforv,sinangle_ticks])tick_formatter1=DictFormatter(dict(angle_ticks))alt_ticks= [(6371.0,'0'), (6671.0,'300'), (6971.0,'600'), (7271.0,'900'), (7571.0,'1200')]grid_locator2=FixedLocator([vforv,sinalt_ticks])tick_formatter2=DictFormatter(dict(alt_ticks))tr_rotate=Affine2D().rotate(1.414)tr_shift=Affine2D().translate(0,6371)tr=polar.PolarTransform()+tr_rotategrid_helper= \floating_axes.GridHelperCurveLinear(tr,extremes=(0,0.314,6371,7871),grid_locator1=grid_locator1,grid_locator2=grid_locator2,tick_formatter1=tick_formatter1,tick_formatter2=tick_formatter2,)ax1=floating_axes.FloatingSubplot(fig,111,grid_helper=grid_helper)ax1.invert_xaxis()fig.add_subplot(ax1,transform=tr)horiz= [Size.Scaled(1.0)]vert= [Size.Scaled(1.0)]ax0_div=Divider(fig,[0.0,0.5,1.0,0.45],horiz,vert,aspect=False)# Rectangular Coordinatesax1_div=Divider(fig,[0.0,0.0,1.0,0.45],horiz,vert,aspect=False)# Curvilinear Coordinatesax0_loc=ax0_div.new_locator(nx=0,ny=0)# Rectangular Coordinatesax1_loc=ax1_div.new_locator(nx=0,ny=0)# Curvilinear Coordinatesax0.set_axes_locator(ax0_loc)# Rectangular Coordinatesax1.set_axes_locator(ax1_loc)# Curvilinear Coordinatesfig.savefig('bug_report.png',bbox_inches='tight')
Actual outcome
Expected outcome
I expected to be able to stretch the curvilinear coordinate system so that its x-axis is aligned with the rectangular coordinate system.
Matplotlib version
- Operating system: Ubuntu 18.04 LTS
- Matplotlib version: 3.3.4
- Matplotlib backend: Qt5Agg
- Python version: 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0]
Matplotlib installed with anacond default linux installer.