bokeh 0.8.2 - None of the bokeh-server glyph examples rendering the plot - python-3.x

I have Python 3.4.3 |Anaconda 2.1.0 (64-bit) on linux and bokeh 0.8.2. None of the bokeh-server examples in
https://github.com/bokeh/bokeh/tree/master/examples/glyphs
are rendering the plot. I can see the widgets and interact with them, but no plot is rendered. The Javascript console says:
Bokeh: could not set initial ranges
I tried with multiple browsers (Chrome, IE and Firefox) with no success. Anyone has a solution to this?

I had the same problem, and solved by clearing the browser's cache, as per this post on Bokeh's discussion group:
https://groups.google.com/a/continuum.io/forum/#!msg/bokeh/4ipIS0lariw/qmWzVSKHCAAJ

OK, after 0.8.2 a change was made that simplified "auto ranging" significantly. However, older versions of Bokeh are not forward-compatible with this change. You need to run the version of the example that came out with the release:
https://github.com/bokeh/bokeh/blob/0.8.2/examples/glyphs/data_tables_server.py
Alternatively you can install a newer version of Bokeh (0.9 or newer).

Related

Why fonts in Qt are appearing blurry or pixelated?

All my fonts are appearing pixelated, so I used AntiAliasing but it isn't helping out. As you can see the pixelated font in the image itself:
This is the code I am currently using:
butt1 = QtWidgets.QLabel("""Scrappr""")
font = QtGui.QFont()
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
font.setPixelSize(22)
font.setFamily('Segoe UI Bold')
butt1.setFont(QtGui.QFont(font))
I tried different solutions on SO, qtforums etc but nothing works for me :(
I tried:
Different combinations of ClearType text but It didn't work out as, by default all the text appears good on windows and chrome but with Qt only, it becomes pixelated.
Changing windows aero theme to classic one...
But none of them helped.
Here are My PC Specs:
windows: 7 ultimate
PySide2 version: 5.14.2.1
Resolution: 1360 X 768
I'm using BrownPro font and the texts were blurry at all resolutions, but much more evident at low resolutions.
I was able to solve the issue by setting the hinting preference for the font to: PreferNoHinting. Applying it at the application level, fixes the issue everywhere.
Here is the documentation: https://doc.qt.io/qt-5/qfont.html#HintingPreference-enum
And here is the code I used:
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Light.ttf");
QFont brown_pro_font("BrownPro");
brown_pro_font.setHintingPreference(QFont::HintingPreference::PreferNoHinting); //This line did the trick
QApplication::setFont(brown_pro_font);
Try to see the fonts used by PyQt5:
import PyQt5
from pyQt5 import QtGui
dir(QtGui.QFont)
the result will show all you need for QFond and the fonts can be used:
[..., 'Helvetica',...,'SansSerif',..., 'Serif',..., 'Times', ...
You can try to add your custom fonts but you need to test each font.
For example, the documentation tells us:
In Windows a request for the “Courier” font is automatically changed to “Courier New”, an improved version of Courier that allows for smooth scaling. The older “Courier” bitmap font can be selected by setting the PreferBitmap style strategy (see setStyleStrategy() ).
Once a font is found, the remaining attributes are matched in order of priority:
fixedPitch()
pointSize() (see below)
weight()
style()
I happen to work with Qt last year and i used qml for building the UI part of my application.
Qt itself prefers us to use qml for building UI, since they have written a UI engine that renders everything better compared to the old engines.
In case of PyQt you are using the python only approach which is only not usually recommended, i am not saying that the qml version is pixel perfect. it still works bad at drawing curves (but that is not the stuff we usually require). As far as your problem is concerned qml will work fine for you (it has much better text rendering).
You might struggle a bit finding the learning resource for qml. But at least give it a shot and yes it is easier much easier than Python only approach.

Suppress plot window when creating figure

For years I have created figures using some rendition of the following code:
import pylab as pl
fig = pl.figure(figsize=(3.5, 2.5))
ax0 = fig.add_subplot(111)
Earlier this week I had to reinstall Python using the most-recent Anaconda Python 3.7 release (previous version was also 3.7). The problem is when I create my figure the figure window appears immediately (normally the figure window would never appear until I called fig.show()). I checked the matplotlib backend to see if it was different, but it is set to qt5agg. I don't think the backend is the problem. Does anyone know of a recent change in matplotlib that would cause the figures to pop up...anyone know how to prevent them from popping up without setting the backent to agg?
Current matplotlib version: 3.1.1

Latest library version shows image border

In this codepen, if opened with Firefox 64.0.2 (64-bit) on MacOS, you will see that each image tile has a border. If library "2.4.0" is replaced with "2.3.1" then the issue disappears.
How to fix this?
src="https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.0/openseadragon.js"

OpenCV 3: Why does the UI render incorrectly?

I am a new to openCV and trying its examples from documentation. I am doing the trackbar as the color palette example.
But my UI renders in wrong order as well as crops the switch title: OFF.
where it is supposed to be like this.
I am using macbook pro with macOS 10.13.
OpenCV's Highgui module uses QT as a backend. QT renders elements differently depending on the OS that is using it. I believe that this is because QT uses UI elements that are native to the OS. So a frame in Windows will look like a Windows Frame, a frame in Linux will look like a Linux frame.
This is what the same example produces in Windows:
You can get the slider bars to fit the window by changing:
cv2.namedWindow('image')
to:
cv2.namedWindow('image',cv2.WND_PROP_AUTOSIZE)
Doing that produces this output (in Windows):

JFree Chart with itext problem with font

I want to use Jfree chart with itext to make a pdf. I have used custom font for JFree chart title and its other components using java.awt.Font class. It works ok in windows but on linux centOS, the title is overlapping with upper line and so do other things. Need help.
Thanks
Found the answer. It's because the two platforms are using different version of java. On Windows its java (SE) 1.6 and on linux I was using openjdk. By making both java SE, problem's solved.

Resources