Customizing Size and Background on 2-D Plots
Two new options, background and size for 2-D plotting commands, allow you to superimpose a plot on a background image, set a background color or specify the size of the plot window.
with⁡ImageTools:withplots:withplottools:
Setting the Size of the Plot Window
Using an Image as the Background
Setting a Background Color
Example
The width and height of the plot window can be given as the number of pixels.
plot⁡sin⁡x,size=500,300,axes=box
If the width is given as a floating-point number, it is interpreted as a proportion of the worksheet width.
plot⁡sin⁡x,size=0.75,350,axes=box
If the height is given as a floating-point number, it is interpreted as the ratio of the height to the width. The height can be the special name "golden"; in this case, the height/width ratio is the reciprocal of the golden ratio.
plot⁡sin⁡x,size=default,golden,axes=box
The image can be specified as either a name (string) of an image file or an image (array) usable by the package. By default, the plot is displayed with the dimensions of the image.
The following example shows the location of all earthquakes of magnitude 2.5 or greater over a seven day period.
Reference: Data compiled by the U.S. Geological Survey.
displaylocMag, background = catkerneloptsdatadir,/images/worldmap.jpg, size = 800, 476, view = −180 .. 180, −y60 .. y80, leg, axes = none;
An image that can be produced or used with the ImageTools package can also be used as the background. The Fractals package can also produce such images.
restart:
p:=x5−x2−200:
sols≔ℜ,ℑ~fsolve⁡p,x,complex
sols:=−2.32691465200619,−1.71884377632728,−2.32691465200619,1.71884377632728,0.872204327279742,−2.73005723686502,0.872204327279742,2.73005723686502,2.90942064945291,0.
a,b:=−3,3
img:=Fractals:-EscapeTime:-Newton⁡400,a+a⁢I,b+b⁢I,p
plot⁡sols,style=point,symbol=diagonalcross,view=a..b,a..b,background=img
The background option can also be used to set the background color.
plot⁡sin⁡x,x=−2⁢π..2⁢π,axis=color=white,background=Black
plot⁡cos⁡x+x,x=−2⁢π..2⁢π,color=Black,background=Goldenrod,size=0.75,0.5
Download Help Document