QCustomPlot Discussion and Comments

Subscript in axis label text?Return to overview

I need to make some characters subscript for my yAxis label, is this possible?

Thanks,

Lachlan

Hi,

at the moment only normal UTF-8 characters are supported -- which does include some sub- and superscripts, see here: https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts.

At some point, maybe even QCP2.0, axis labels and QCPItemText will support richtext, and in this way <sub> and <sup> tags.

Hi,

It seems it didn't make it to QCP2.0; any new plans regarding this?

you could create your own text item that supports html using this method:

void MainWindow::paintEvent(QPaintEvent*)
{
QPainter painter(this);
QTextDocument td;
td.setHtml("K<sub>max</sub>=K<sub>2</sub> &middot; 3");
td.drawContents(&painter);
}