Line Chart Tutorial

BRIDGES provides a basic set of line charts (https://en.wikipedia.org/wiki/Line_chart) for plotting single or multiple functions; its most often useful in benchmarking algorithms.

Individual functions are represented by pairs of arrays, say xdata and ydata such that there is a point at (xdata[0], ydata[0]), an other at (xdata[1], ydata[1]), ... One can add a series by passing the two arrays using setDataSeries() or add the arrays individually using setXData() and setYData().

The different series have a label associated with them by default which can be disabled (see toggleSeriesLabel())

The data is typically shown with axes that use a linear scale. However, the scale can be changed to logarithmic for each axis individually (see toggleLogarithmicX() and toggleLogarithmic()).

The LineChart can have a title (see getTitle() and setTitle()) and a subtitle (see setSubTitle() and getSubTitle()).

This tutorial will illustrate the use of line charts to draw functions in both linear and logarithmic scale.

See also

See complete documentation of Line charts for C++, Java , or Python

Code Example

Here is the code for this tutorial. The expected visualization follows that. Hit the 'l' button to turn on the labels.

Java
C++
Python

If you follow the URL given to you when the application runs, it will get to to the Bridges webpage that shows your output (also shown below). You do not need to be logged into your BRIDGES account to see the output. If you are logged into your account, the output will show up in your gallery.