[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
# JKQtPlotter
## Line Graph with Logarithmic y-axis
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQtPlotter widget (as a new window) and several line-graphs of different resonance curves.
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](https://github.com/jkriege2/JKQtPlotter/blob/master/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->set_style()`). The colors are set automtically from an internal default palette. The main loop looks like this:
The difference between not using and using `$...$` for the equation can be seen here:
- no $-math-mode: ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_logaxes_lowqmathrendering.png)
- using $-math-mode: ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_logaxes_highqmathrendering.png)
Finally the y-axis is switched to logarithmic scaling and the axis labels are set:
```c++
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.get_xAxis()`)
plot.get_yAxis()->set_logAxis(true);
// now we set the number of label ticks to 9 (you give the count if minor between two majors,
// so if you want ticks for 1,2,3,...,10,20,30,...,100... you need to use 9:
plot.get_yAxis()->set_minorTicks(9);
// the minor grid is not shown by default. You can switch it on:
plot.get_yAxis()->set_drawMinorGrid(true);
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
plot.get_xAxis()->set_axisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");
```
As an alternative `JKQTPCALTexponentCharacter` does not use the power-of-10 notation, but uses the usual unit-characters, e.g. 0.001=1m, 0.000001=1µ, 10000=10k, ...