Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

physically stretch plot in horizontal direction in python

I want a simple x,y plot created with matplotlib stretched physically in x-direction.
The intention is to get a result were it is easier for me to detect features in the signal.

So I don't want to change any scales or values or limits. Just change the distance between two gridpoint in my output file...

I want to do that on four subplots which should have the same size afterwards.

Thanks in advance... I tried for hours now and I think one of you could probably help me...

David Zwicker already solved my problem in this special case, thanks a lot for that, but in general... If I plot 2 subplots like in this code:

fig = plt.figure()

ax1 = fig.add_subplot(1,2,1)

plot(u_av,z)

ax2 = fig.add_subplot(1,2,2)

plot(pgrd_av,z)

clf()

and want to stretch only one of them. What can I do?

like image 439
Bachbold Avatar asked Dec 05 '13 11:12

Bachbold


People also ask

How do you stretch a plot?

To stretch or shrink the graph in the y direction, multiply or divide the output by a constant. 2f (x) is stretched in the y direction by a factor of 2, and f (x) is shrunk in the y direction by a factor of 2 (or stretched by a factor of ).

How do you plot horizontally?

To graph a horizontal line that goes through a given point, first plot that point. Then draw a straight line left and right that goes through the point, and you're done!


1 Answers

You can change the figure size by using plt.figure(figsize=(20,5)). See the documentation of the figure command.

like image 190
David Zwicker Avatar answered Sep 23 '22 18:09

David Zwicker