Previous Page Next Page Contents

plot::copy -- create a copy of a graphical primitive

Introduction

plot::copy(o) returns a copy of the graphical object o.

Call(s)

plot::copy(o)

Parameters

o - graphical object, i.e., an object of type "graphprim"

Returns

an object of the same domain type as o.

Related Functions

plot::modify

Details

Example 1

We create an object representing a two-dimensional function plot:

>> f:= plot::Function2d(sin(x), x = 0..2*PI):
   plot(f)

If we want to add another graph to the same graphical scene, built of f by changing its term to the cosine function and its color to blue, we must first create a copy of f and then change the term attribute term and the options Color and Title as desired:

>> g:= plot::copy(f): g::term:= cos(x):
   g::Title := "cos(x)": g::Color:= RGB::Blue:
   plot(f, g)

Example 2

This example illustrate the reference effect for graphical objects. Let us create a scene consisting of three graphical objects:

>> s:= plot::Scene(
     plot::Function2d(1/x, x = 1..50),  
     plot::Pointlist([n, sin(n)/n] $ n = 1..50, Color = RGB::Blue),  
     plot::Function2d(-1/x, x = 1..50)
   ):
   plot(s)

If we want to increase the size of the points of the graph of the sequence n -> sin(n)/n, we may extract the corresponding graphical object of that scene:

>> p:= s[2]
                             plot::Pointlist()

and set the corresponding plot option PointWidth to the value 50:

>> p::PointWidth:= 50: plot(s)

Changes on the object p reflects changes on every object that consists of p, such as the graphical scene s in this example. This is called the "reference effect".

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000