[Matplotlib-users] log xaxis for contourf

Ian Thomas ianthomas23 at gmail.com
Fri Nov 24 02:36:36 EST 2017


Dimitri,

If you send me your data (f_psd_welch, traverseCoord and
psd_hotwire_FS_welch) I will take a look at the problem.

Ian

On 24 November 2017 at 02:42, dimitrif <df388 at cam.ac.uk> wrote:

> Hi to all,
>
> I spent about 3 hours trying to fix a plotting problem I have with
> matplotlib.pyplot...unfortunately without any sucess.
>
> I want to have a logarithmic xaxis in my contourf plot. Since this is not
> directly possible, I took the log10 of the axis and simply used them. Doing
> so, I get some white space inside the plot for some reason. Can someone
> give
> me a hint why this is happening? I use the following fraction of code:
>
> #without log scale
> plt.figure(11), plt.cla()
> cf1 = plt.contourf(f_psd_welch, traverseCoord,
> 10*np.log10(psd_hotwire_FS_welch),cmap='viridis')
> cbar1 = plt.colorbar(cf1)
> plt.xlim([min(f_psd_welch), max(f_psd_welch)]), plt.ylim([-50, 50])
>
> <http://matplotlib.1069221.n5.nabble.com/file/t5112/normalX.png>
>
> #with logscale
> plt.figure(11), plt.cla()
> cf1 = plt.contourf(np.log10(f_psd_welch), traverseCoord,
> 10*np.log10(psd_hotwire_FS_welch),cmap='viridis')
> cbar1 = plt.colorbar(cf1)
> plt.xlim([min(np.log10(f_psd_welch[1:])), max(np.log10(f_psd_welch[1:]))
> ]),
> plt.ylim([-50, 50])
>
> <http://matplotlib.1069221.n5.nabble.com/file/t5112/logX.png>
>
> The output is attached.
> I would be happy about any help!
>
> Thanks,
> Dimitri
>
>
>
> --
> Sent from: http://matplotlib.1069221.n5.nabble.com/matplotlib-users-
> f3.html
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20171124/d5555630/attachment.html>


More information about the Matplotlib-users mailing list