CoordinateType

Linear versus logarithmic plots in 2D

Value Summary

InheritedSee below

Graphics Primitives

ObjectsCoordinateType Default Values
plot::CoordinateSystem2dLinLin

Description

CoordinateType allows to switch between linear and logarithmic 2D plots.

By default, a linear (Cartesian) scaling of all coordinate axes is used in 2D. This corresponds to CoordinateType = LinLin. Logarithmic plots are created by choosing a CoordinateType different from LinLin.

In 2D, the following coordinate types are available:

  • LinLin: Straight lines given by y = c1x + c2 are rendered as straight lines on the screen.

  • LinLog: Linear coordinates are plotted along the horizontal axis, logarithmic coordinates along the vertical axis. The curves are rendered as straight lines on the screen.

  • LogLin: Logarithmic coordinates are plotted along the horizontal axis, linear coordinates along the vertical axis. The curves y = c1ln(x) + c2 are rendered as straight lines on the screen.

  • LogLog: Logarithmic coordinates are plotted along both axes. The curves y = c1xc2 are rendered as straight lines on the screen.

The objects to be plotted must have strictly positive coordinate values in "logarithmic directions".

Examples

Example 1

We consider an exponential function:

plot(plot::Function2d(5*exp(x/4), x = -10 .. 100), 
     CoordinateType = LinLin):

In a singly logarithmic plot, the graph is a straight line:

plot(plot::Function2d(5*exp(x/4), x = 0 .. 100), 
     CoordinateType = LinLog):

Example 2

We render the function in a log-log plot:

plot(plot::Function2d(sqrt(x) + x^2, x = 10^(-3) .. 10^3), 
     CoordinateType = LogLog):

Was this topic helpful?