QCustomPlot Discussion and Comments

QCustomPlot 2.0.0 is blurry with Retina DisplayReturn to overview

I'm using the beta release of QCP 2.0.0 released on Sep 13, 2016 and I'm on a Macbook Pro Retina running El Capitan.

I've promoted a QWidget to be the QCustomPlot. Initially, the plot axes are blurry (http://tinypic.com/r/143grgg/9). If I "setOpenGl(true)" the plot is horribly scaled (http://tinypic.com/r/15rjuvb/9).

In the release notes for 2.0.0, QCP supports high-dpi displays. What else do I need to do in order to reduce the blurriness of the text/plot and/or allow OpenGL to be the back-end renderer?

Many thanks!

What will happen, if you set in your application Qt::AA_EnableHighDpiScaling?
http://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum

Setting that flag had no effect.

It is interesting to note that the blurriness only affects the axis tick labels. Axis labels, traces, titles, etc... are fine. Just the tick marks are blurry.

You can see that here: http://i66.tinypic.com/2z4mh3a.png

Probably bug. :D

Does it change if you disable label caching?
customPlot->setPlottingHint(QCP::phCacheLabels, false);

The High-DPI support was programmed only on a "fake" high-dpi within a virtual machine. It seems that didn't fully reproduce how real High-DPIs behave, so I'll need to get my hands on one soon.

DerManu, disabling label caching did the trick! Many thanks.

Okay, now I at least know where I've got to look for the issue. Of course it's supposed to work with label-caching enabled, the device pixel ratio is actually passed to the pixmap cache...

That solved the label issue when not using OpenGL, however, when I use OpenGL, the scaling is off. I'd like to use the performance of OpenGL.

Any hints on what that issue may be?

Just wanted to ping this thread again, any updates on why OpenGL scaling would be off on a retina display?

Well it seems that developers forget about scale bug(

Hotfix is to set bufferDevicePixelRatio to 0.5:

plotWidget->setBufferDevicePixelRatio(.5);

and then in the qcustomplot.cpp lines form 942 to 944 should be changed from:

mGlFrameBuffer = new QOpenGLFramebufferObject(mSize*mDevicePixelRatio, frameBufferFormat);
  if (mGlPaintDevice.data()->size() != mSize*mDevicePixelRatio)
    mGlPaintDevice.data()->setSize(mSize*mDevicePixelRatio);

to the following lines:

mGlFrameBuffer = new QOpenGLFramebufferObject(mSize*mDevicePixelRatio*2, frameBufferFormat);
  if (mGlPaintDevice.data()->size() != mSize*mDevicePixelRatio*2)
    mGlPaintDevice.data()->setSize(mSize*mDevicePixelRatio*2);

fix working only for retina displays and I think will work bad for non-retina displays.

Hi, I am really, really late to the conversation. But I'm on MACOS and this scaling issue is happening for me. I've tried tanshihaj's hotfix but it also doesn't change anything. I've tried setting highDPI and changing multisampling parameter, but neither of those two is helping either.

Has anyone managed to solve this..?

Same issue here :/.

Not sure why yet, but forcing device pixel ratio to 1.0 in QCustomPlot::paintEvent seems to "fix" the issue. I'll investigate more.