0
votes

I have two different sets of data which span different X values and intervals

For instance,

A : spans from 0 to 100 B : spans from 1000 to 1200

I want to create 2 different plots (one for each set), but in order to visually compare them, I want them to use the same "size per unit" (i.e. number of unit per pixel, assuming you do not re-size the plot) on the X axis.

By default, plot B will be the same total width as A, but with a "scale" twice as small (say 10 units per pixel instead of 5 units per pixel in A). What I'd like instead is both plot with 5 units per pixel but B with twice the width of A.

I tried looking for "scale" in matplotlib documentation, but that's something completely different (transformation function applied between actual data and displayed data).

Any help will be appreciated, thanks :)

EDIT: so I kept looking, and I guess I could chose a size per unit and calculate the length of the interval spanned by my data myself, and then explicitly specify the width of the figure. But isn't there a built-in way to do that?

1

1 Answers

0
votes

What you're looking for is 'Axis customization'. I don't have a working setup of matplotlib here to test it, but the method to use seems to be

YAxis::set_data_interval(min, max)

to set the vertical (typical value axis) limits on the displayed data.