LogLog
Loglog plots are line plots where both :math:x and :math:y-axis are on
the log scale.
Examples
- Regular loglog plot.
::
let x = logspace(-1.0, 2.0, num:50)
let y = x.apply({t => pow(2.0, t)})
loglog(x, y)
.. image:: ../../../tests/imgs/loglog_plot/loglog_1.png :align: center :width: 360
- Two loglog plots in different directions.
::
let temp = linspace<Float64>(-1.0, 2.0, num: 50)
let x = temp.apply({t => pow(10.0, t)})
let y1 = x.apply({t => pow(10.0, t)})
let y2 = x.apply({t => 1.0 / pow(10.0, t)})
loglog(x, y1, x, y2)
.. image:: ../../../tests/imgs/loglog_plot/loglog_2.png :align: center :width: 360
::
let temp = linspace<Float64>(-1.0, 2.0, num: 10000)
let x = temp.apply({t => pow(10.0, t)})
let y = x.apply({t => 5.0 + 3.0 * sin(t)})
loglog(x, y)
yticks(vector<Float64>([3.0, 4.0, 5.0, 6.0, 7.0]))
xlabel("x")
ylabel("5+3 sin(x)")
.. image:: ../../../tests/imgs/loglog_plot/loglog_3.png :align: center :width: 360
- Example showing loglog plot in scatter mode and custom markers.
::
let temp = linspace<Float64>(-1.0, 2.0, num: 20)
let x = temp.apply({t => pow(10.0, t)})
let y = x.apply({t => pow(10.0, t)})
let l = loglog(x, y, line_spec: "s")
l.marker_face_color(0.0, 0.447, 0.741)
xlabel("x")
ylabel("10^x")
.. image:: ../../../tests/imgs/loglog_plot/loglog_4.png :align: center :width: 360
::
let temp = linspace<Float64>(-1.0, 2.0, num: 10000)
let x = temp.apply({t => pow(10.0, t)})
let y1 = x.apply({t => 5.0 + 3.0 * sin(t / 4.0)})
let y2 = x.apply({t => 5.0 - 3.0 * sin(t / 4.0)})
let l = loglog(x, y1, x, y2, line_spec: "--")
axis(0.1, 100.0, 2.0, 8.0)
.. image:: ../../../tests/imgs/loglog_plot/loglog_5.png :align: center :width: 360
- Another regular loglog plot.
::
let y = vector<Float64>([0.001, 0.01, 0.1, 1.0, 10.0, 100.0])
loglog(y)
.. image:: ../../../tests/imgs/loglog_plot/loglog_6.png :align: center :width: 360
- Multiple loglog plot lines given as a matrix.
::
let y_list = [[0.001, 0.01, 0.1, 1.0, 10.0],
[0.01, 0.1, 1.0, 10.0, 100.0],
[0.1, 1.0, 10.0, 100.0, 1000.0]]
let Y = matrix<Float64>(y_list)
loglog(Y)
.. image:: ../../../tests/imgs/loglog_plot/loglog_7.png :align: center :width: 360
- Loglog plot in a tiled layout.
::
let temp = linspace(-1.0, 2.0, num:50)
let x = temp.apply({t => pow(10.0, t)})
tiledlayout(2, 1)
let ax1 = nexttile()
let y1 = x.apply({t => pow(10.0, t)})
loglog(ax1, x, y1)
let ax2 = nexttile()
let y2 = x.apply({t => 1.0 / pow(10.0, t)})
loglog(ax2, x, y2)
.. image:: ../../../tests/imgs/loglog_plot/loglog_8.png :align: center :width: 360
::
let temp = linspace(-1.0, 2.0, num:50)
let x = temp.apply({t => pow(10.0, t)})
let y1 = x.apply({t => pow(10.0, t)})
let y2 = x.apply({t => 1.0 / pow(10.0, t)})
loglog(x, y1, x, y2)
.. image:: ../../../tests/imgs/loglog_plot/loglog_9.png :align: center :width: 360
Methods
======================= ============================================================= Method Description ======================= ============================================================= loglog 5 methods Plot a loglog line with y versus x. ======================= =============================================================
Description
.. function:: loglog(x, y, line_spec!)
:param x: Vector<Float64>
:param y: Vector<Float64>
:param line_spec: String
:return: Line
Plot a loglog line with :math:`y` versus :math:`x`.
.. function:: loglog(x1, y1, x2, y2, line_spec!)
:param x1: Vector<Float64>
:param y1: Vector<Float64>
:param x2: Vector<Float64>
:param y2: Vector<Float64>
:param line_spec: String
Plot two loglog lines with :math:`y_1` versus :math:`x_1` and :math:`y_2` versus :math:`x_2`.
.. function:: loglog(y, line_spec!)
:param y: Vector<Float64>
:param line_spec: String
Plot a loglog line with :math:`y`.
.. function:: loglog(y, line_spec!)
:param y: Matrix<Float64>
:param line_spec: String
Plot loglog lines with :math:`y`.
.. function:: loglog(axes, x, y, line_spec!)
:param axes: AxesType
:param x: Vector<Float64>
:param y: Vector<Float64>
:param line_spec: String
:return: Line
Plot a loglog line with :math:`y` versus :math:`x` in given axes.