# For graphing, associating custom x-values with each Y?

Hello, all. This is my first time posting here, as I am new with Sage and have only started learning it this semester for a math class. So far I really love it.

I'm pretty sure this is a very basic question, but please bear with me. I have a set of Y-values in a given sequence that I would like to graph, which would normally not be a problem with "finance.TimeSeries," but I want to associate a custom set of X-values with the Y-values to be used in the graphing, and not x=o up to however far away my last Y-value is. For ex., I have Y's = [1, 2, 4, 6], and would like to graph [(3, 1), (2, 2), (12, 4), (5, 6)], instead of [(0, 1), (1, 2), (2, 4), (3, 6)].

Thanks to any replies in advance.

edit retag close merge delete

Sort by ยป oldest newest most voted

You can try:

sage: points([(3, 1), (2, 2), (12, 4), (5, 6)])

more

What would I do with those points then?

more

If you have two separated lists of values you can zip the lists:

Y = [0,1,2,3]
X = [3,2,12,5]
P = zip(X,Y)
print P
points(P)

more

This worked for me, thanks a lot, man! I'm glad someone somewhere decided to make a command for something so simple and routine.

( 2016-03-18 00:20:31 +0200 )edit