How do you define the domain of a plot? For instance, if I want to plot a standardized bivariate normal density function (with $r=0$), how do I specify the domain to be $[-3,3]$?
migrated from stats.stackexchange.com Feb 24 '12 at 8:08
This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.
For simple regions like your interval or a square region, you can just give the appropriate border, as shown by the earlier answers. For completeness, I repeat them here:
Domain $[-3,3]\times [-3,3]$:
For more complex domains, you have several options:
First, you can explicitly use a function with limited domain, e.g. for the domain $[-2,-1)\cup(1,2]$:
Or for 2D:
Another possibility is to give the region in the plot command:
Finally, for 3D plot you might also use some parametrization of your domain resulting in a square parameter range and use
Of course you can also combine those methods, e.g.
You can either plot the function only for a narrow range, or play around with the
There is an important difference between specifying the plot range a la
Here's an example that uses both options: It first calculates your multivariate distribution on $(x,y)\in([-5,5],[-5,5])$, and then displays only the proportion that lies in $([-5,3],[-2,3])$: