Ask Your Question

PhilosophiƦ Naturalis's profile - activity

2019-08-11 19:46:51 +0200 received badge  Notable Question (source)
2019-08-08 09:04:26 +0200 received badge  Famous Question (source)
2018-02-22 17:58:52 +0200 received badge  Popular Question (source)
2018-02-10 05:09:21 +0200 received badge  Popular Question (source)
2018-02-10 05:09:21 +0200 received badge  Notable Question (source)
2016-04-08 12:24:16 +0200 received badge  Supporter (source)
2016-04-07 13:07:12 +0200 asked a question How to enforce limits to the x-axis in plots?

I want to plot a function, say $ f(x) = \frac{1}{x} $, in a certain interval, $ x \in [-2, 2] $, but produce the resulting plot in a broader interval, $ x \in [-3, 3] $, and store it as a graphical file. This case occurs, e.g., when a function is well-defined only in a certain region, but the plot should illustrate a broader region.

Currently, I pass the new $x$-axis range via show as follows:

p = plot(1/x, (x, -2, 2), ymax = 10, ymin = -10, exclude = [0])
p.show(xmin = -3, xmax = 3)
p.save("plot.svg")

Is it possible to change the $x$-axis range in a more direct way (without using show)? For instance,

p = plot(1/x, (x, -2, 2), ymax = 10, ymin = -10, exclude = [0])
p.xmin = -3 
p.xmax = 3
p.save("plot.svg")
2016-01-13 12:23:54 +0200 received badge  Scholar (source)
2016-01-13 11:57:16 +0200 received badge  Student (source)
2016-01-13 11:55:20 +0200 asked a question Tick labels in a matrix plot

I want to plot the following matrix m with k and l in {-2, ..., 2}:

m = [[k+l for k in range(-2,3)] for l in range(-2,3)]

with matrix_plot:

m_plot = matrix_plot(m, origin='lower')

The ticks on both axes are automatically set to {0 , ... , 5}, but I want the ticks to be {-2, -1, 0, 1, 2} on both axes. I could not figure out how to do this.