Ask Your Question

Revision history [back]

range() function in list_plot not working?

I'm trying to generate a list plot of points that satisfy the relation { (x,2x) | x = 0,+-1, +-2 }. That is, 5 discrete integer values of x ranging from -2 to +2 that satisfy the equation y = 2x.

I figured my solution...show(list_plot([x*2 for x in range(-2,3)]), figsize=3) should have worked; however, the resulting plot ends up shifted to the incorrect domain. I can't upload the image because my karma is too low, but the resulting plot fits the function y = 2(x - 2). It gives the correct range of y values, from -4 to 4, but the domain is from 0 to 4.

Anybody know what I'm missing? Thanks!