2

I'm trying to remove the white spaces padding matplotlib's generated spectrogram. I've tried setting a limit to the axis and setting tight to the axis but these don't work.

Here's a screenshot: Screenshot with padding

Thanks

berna1111
  • 1,811
  • 1
  • 18
  • 23
congIA
  • 25
  • 2
  • Possible duplicate of [Python, Matplotlib, subplot: How to set the axis range?](http://stackoverflow.com/questions/2849286/python-matplotlib-subplot-how-to-set-the-axis-range) – berna1111 Oct 19 '16 at 10:43

1 Answers1

0

You can use plt.xlim() and plt.ylim() with the desired limits.

Your plt.axis(...) should have done, try to run it after the plot.

Similar question, and another.

Community
  • 1
  • 1
berna1111
  • 1,811
  • 1
  • 18
  • 23
  • I tried with those functions but they don't work. I'm using Jupyter so I thought it was a problem with – congIA Oct 20 '16 at 00:51
  • ... "%matplotlib notebook", so I changed that to "%matplotlib inline" like how they show up in examples but that doesn't work either. – congIA Oct 20 '16 at 00:52
  • Have you tried to use those commands after the `plt.specgram`? Or use the `set_autoscale_on(False)` on your axis before drawing? – berna1111 Oct 20 '16 at 13:31