0

I'm creating a colour map which has 64 horizontal data points and 3072 vertical. When I plot it, the scaling on both axes is the same and so the horizontal axis is super squished and tiny, and I can't get any information from it. I've tried changing the figsize parameter but nothing changes the actual plot, only the image that contains it. Any ideas on how to change my plot so that the actual length of the axes are the same? Below is my plotting code:

def plot_plot(self, data, title="Pixel Plot"):
        pixel_plot = plt.imshow(data)
        plt.title(title)
        plt.colorbar(pixel_plot)
        plt.show(pixel_plot) 

thanks in advance!

NmcL
  • 1
  • 2
  • 1
    Does this answer your question? [How do I change the size of figures drawn with Matplotlib?](https://stackoverflow.com/questions/332289/how-do-i-change-the-size-of-figures-drawn-with-matplotlib) – iacob Jun 01 '22 at 20:06
  • unfortunately no - that just changes the size of the actual figure, not the plot axis – NmcL Jun 01 '22 at 21:03
  • The plot is plotted _on_ the figure. Doubling the width of the figure (while keeping the height constant) will double the width of all plots on it also. – iacob Jun 01 '22 at 23:19

1 Answers1

0

I think you want the aspect option in plt.imshow(). So something like plt.imshow(data, aspect=0.1) or plt.imshow(data, aspect='equal')

See this solution: https://stackoverflow.com/a/13390798/12133280

pasnik
  • 226
  • 1
  • 5