Closed EDrabek closed 12 years ago
My guess is that you're creating an axes but not adding it to a figure. So, imshow creates its own.
See if adding this line helps. This needs to be added after you create an axes with AxesWcs.
fig.add_axes(ax)
If this does not help, please post an simple but complete code.
I included your suggestion and received the following error:
Traceback (most recent call last):
File "run_PV_outflow.py", line 21, in
Okay, this is something that has been fixed in the master branch. I just pushed new release (v0.1b2) that I believe fixes this bug. Please try it (you should be able to download it from the download page) and see if it works.
It seems to have been fixed! Thank you for your quick response. Cheers.
Hi,
I am having an issue when attempting to plot a position-velocity diagram (x-axis position using an offset axis I created in arc min and y-axis in velocity). The program runs smoothly and outputs a plot, but the axes are wrong. I believe the x-axis is centred correctly at CPIX1 but the labels seem to be in pixels and I'm unsure about the y-axis. Here is the snippet of the program I am using:
def pv_plot(pvhdulist,plotname): pvplotdata=numpy.where(pvhdulist[0].data>=0,numpy.sqrt(pvhdulist[0].data),0) fig=plt.figure() ax=pywcsgrid2.axes_wcs.AxesWcs(fig,[0.2,0.2,0.7,0.7],header=pvhdulist[0].header) ax.set_ticklabel1_type("absval",nbins=5) ax.set_ticklabel2_type("absval",scale=0.001,nbins=9) pylab.imshow(pvplotdata, origin="low", interpolation="nearest", aspect=0.04, vmin=0, vmax=10,cmap=pylab.cm.gist_heat) plt.savefig(plotname+".png",dpi=300,orientation="landscape",transparent="True",bbox_inches="tight")
No matter how I change with ax.set_ticklabel1_type (if I change it to "arcmin" and choose an offset for example for the x-axis), the axes ticks do not change.
Has this problem been encountered before?