Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to specify x and y axis values in Sage plot?

So, I have three lists in Sage, one of them, and I want to combine two list plots, where in one of them I have the expected values, and in the other one I have the simulation results, and the third one is the x-axis values that corresponds to these points. So my lists (all same size), look like this:

# al removed partially for brevity
expected  = [47.4246, 47.9955, 95.9383]
simulated = [47.2, 48, 96]
primes    = [23327, 3009311, 886463]

# plotting
p = list_plot(expected, color='blue', marker='o') + list_plot(simulated, color='red', marker='x')
p.save('plot.svg')

Now, this creates a plot, and the y-axis corresponds to the values in expected and simulated lists, but I do not know how to incorporate the values in primes to the x-axis. So that I have 47.4246 for expected and 47.2 for simulated in the y-axis when I have 23327 in x-axis. Any ideas how to do this in Sage?

How to specify x and y axis values in Sage plot?

So, I have three lists in Sage, one of them, and I want to combine two list plots, where in one of them I have the expected values, and in the other one I have the simulation results, and the third one is the x-axis values that corresponds to these points. So my lists (all same size), look like this:

# al removed partially for brevity
expected  = [47.4246, 47.9955, 95.9383]
simulated = [47.2, 48, 96]
primes    = [23327, 3009311, 886463]

# plotting
p = list_plot(expected, color='blue', marker='o') + list_plot(simulated, color='red', marker='x')
p.save('plot.svg')

Now, this creates a plot, and the y-axis corresponds to the values in expected and simulated lists, but I do not know how to incorporate the values in primes to the x-axis. So that I have 47.4246 for expected and 47.2 for simulated in the y-axis when I have 23327 in x-axis. Any ideas how to do this in Sage?

How to specify x and y axis values in Sage plot?

So, I have three lists in Sage, and I want to combine two list plots, where in one of them I have the expected values, and in the other one I have the simulation results, and the third one is the x-axis values that corresponds to these points. So my lists (all same size), look like this:

# al all lists removed partially for brevity
expected  = [47.4246, 47.9955, 95.9383]
simulated = [47.2, 48, 96]
primes    = [23327, 3009311, 886463]

# plotting
p = list_plot(expected, color='blue', marker='o') + list_plot(simulated, color='red', marker='x')
p.save('plot.svg')

Now, this creates a plot, and the y-axis corresponds to the values in expected and simulated lists, but I do not know how to incorporate the values in primes to the x-axis. So that I have 47.4246 for expected and 47.2 for simulated in the y-axis when I have 23327 in x-axis. Any ideas how to do this in Sage?

How to specify x and y axis values in Sage plot?

So, I have three lists in Sage, and I want to combine two list plots, where in one of them I have the expected values, and in the other one I have the simulation results, and the third one is the x-axis values that corresponds to these points. So my lists (all same size), look like this:

# all lists removed partially for brevity
expected  = [47.4246, 47.9955, 95.9383]
simulated = [47.2, 48, 96]
primes    = [23327, 3009311, 886463]

# plotting
p = list_plot(expected, color='blue', marker='o') + list_plot(simulated, color='red', marker='x')
p.save('plot.svg')

Now, this creates a plot, and the y-axis corresponds to the values in expected and simulated lists, but I do not know how to incorporate the values in primes to the x-axis. So that I have 47.4246 for expected and 47.2 for simulated in the y-axis when I have 23327 in x-axis. x-axis, and so on. Any ideas how to do this in Sage?